Thanks so Peter, works great! Surrey -- View this message in context: http://r.789695.n4.nabble.com/Selecting-the-first-occurrence-of-a-value-after-an-occurrence-of-a-different-value-tp3217340p3221271.html Sent from the R help mailing list archive at Nabble.com.