Compare cell to a range or table

mkellycole

New member
Joined
Nov 12, 2015
Messages
24
Reaction score
0
Points
0
Excel Version(s)
2016
I am trying to look at a cell value, find it in a A and B column of range.

A1=24
a2=10 B2-19 c2=A
a3=20 B3= 29 B3=B
A4=30 b4=39 c4=C
D1= the answer

I want to look up A1, find which range it is, and return whatever in in the corresponding C cell. In this example, a "B" would be returned to Cell D1.View attachment Compare Formula.xlsx
 
I used what you have in your post for my solution. I believe you post is different from the worksheet you submitted.

So in cell D1 I would have the following formula:

IF(AND(A1>=A2,A1<=B2),"A",IF(AND(A1>=A3,A1<=B3),"B",IF(AND(A1>=A4,A1<=B4),"C","error")))

Please test it thoroughly. I've never been fond of nested if formulas.
 
Another option
=INDEX(C3:C6,MATCH(A1,A3:A6,1))
 
Back
Top