We propose and implement a new method to estimate treatment effects in settings where individuals need to be in a certain state (e.g. unemployment) to be eligible for a treatment, treatments may commence at different points in time, and the outcome of interest is realized after the individual left the initial state. An example concerns the effect of training on earnings in subsequent employment. Any evaluation needs to take into account that some of those who are not trained at a certain time in unemployment will leave unemployment before training while others will be trained later. We are interested in effects of the treatment at a certain elapsed duration compared to "no treatment at any subsequent duration". We prove identification under unconfoundedness and propose inverse probability weighting estimators. A key feature is that the weights given to outcome observations of non-treated depend on the remaining time in the initial state. We study earnings effects of WIA training in the US and long-run effects of a training program for unemployed workers in Sweden.