Sincere thanks to Jim Holtman and J. Hosking for their suggestions. both their solutions work perfectly, in particular the "findInterval" function is what I was looking for. Cheers. Mahesh Krishnan