Hi, Thanks Michael, but i think this is even slower. x <-sample(20000000) which(x < 5)[1] which.max(x < 5) system.time(for(i in 1:100) which.max(x < 5)) User System verstrichen 60.84 13.70 86.33 system.time(for(i in 1:100) which(x < 5)[1]) User System verstrichen 40.45 8.25 48.95 Thanks, Nico