View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.misc
George
 
Posts: n/a
Default how to return a certain value if a number is within a range

No, the table would only be 11 rows
The way vlookup works, anything between 0 to less than 5
would take the zero, etc up to anything between 85 to 100 gets 10.
Anything over 100 would get -1 (just in case)

It fits your number in the ranges between each row

George

Caconz wrote:

"George" wrote:


A simple VLOOKUP should do the trick

Col A Col B
0 1
5 2
10 3
etc.
85 10
100 -1 (-1 to signify error)

=VLOOKUP(A1,$B$1:$B$B11,2)

George


Thanks for the reply, but that would be a little cumbersome, as for every
number from 0 to 100 I would have to place in a table with its corrosponding
result. I will use this, unless someone else has a better option.