There might be (probably is) an easier way but here's what I would do.
1. Switch from HLOOKUP to INDEX so your original formula (assuming value in A1 and range in A3:M3) would be
==INDEX(A3:M3,1,MATCH(A1,A3:M3,1))
2. We need to compare the difference between the 1 above and the one below that number. The value above can be found by
=INDEX(A3:M3,1,MATCH(A1,A3:M3,1)+1)
Sooooooo
IF(A1-INDEX(A3:M3,1,MATCH(A1,A3:M3,1))>=INDEX(A3:M3,1,MATCH(A1,A3:M3,1)+1)-A1,=INDEX(A3:M3,1,MATCH(A1,A3:M3,1)),=INDEX(A3:M3,1,MATCH(A1,A3:M3,1)+1))
Questions? Does it work?
2.
Bookmarks