View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Toppers
 
Posts: n/a
Default Lookup a value between two numbers

If I understood correctly:

For any value between 0 and 15000, you want 0 returned. For 15001 to 30000
you want 1, etc ?

If this is correct, then you just set up the table as my previous posting
with the "Cut-off" points in column A and the "Value" (0,1,2) in column B.

Column C1 contains 12000 so the formula placed in D1 should return 0; if C1
contains 24500 it should return 1.

If I have completely misunderstood, my apologies.

"Toppers" wrote:

Set up table as below Columns A & B). Table must be in descending order with
large number at top to catch values up to your maximum. In example
max<=9999999

A B
9999999 3
50000 2
30000 1
15000 0

Assume lookup value is in C1 then in D1 put:

=INDEX($A$1:$B$4,MATCH(C1,$A$1:$A$4,-1),2)

HTH

" wrote:

If you have two values that equals a certain value, now let says the
value that you have falls in between these two values, how do you get
excel to reconize this and return the correct value? For instance:

0 to 15,000 = 0
15,000 to 30,000 = 1
30,000 to 50,000 = 2


My table I have layed out with each value assigned to separate cells.
Is this the correct way to lay this table out? In addition, In order
to see if I could get the result I need I did a VLOOKUP and the formula
returned a #N/A error. What am I doing wrong? Appreciate some help,
Thanks Don