VLookup between two values

ClaireEx

New Member
Joined
Jun 19, 2015
Messages
3
Hi all,

I hope this hasn't been answered elsewhere but I haven't found anything.

I have three columns of data. For each value in column C, I want to determine if it falls between two values in the same row in column A and B

e.g. if C1 = 30, A20=25 and B20=40, I want to return "TRUE" in D1.

I tried =VLOOKUP(C1, A:B, 2, TRUE) but the problem is that if C is NOT between two values on the same row in columns A and B, it just returns the nearest value from one of the columns.

All I want is to differentiate values in column C that fall DO between any pair of values in A and B from values that DON'T.

Any suggestions hugely appreciated! Thanks in advance.
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Welcome to the forum.

Try

=IF(COUNTIFS($A$1:$A$30,"<"&C1,$B$1:$B$30,">"&C1),"True","")
 
Upvote 0
Hi. Im slightly confused. How is C1 in the same row as A20 and B20? Aside from that I thought you wanted this:

=IF(AND(C1 < B1,C1 > A1),TRUE,FALSE)
 
Upvote 0
Hi. Im slightly confused. How is C1 in the same row as A20 and B20? Aside from that I thought you wanted this:

=IF(AND(C1 < B1,C1 > A1),TRUE,FALSE)

Hi thanks for replying

So A and B are positionally related to one another, but C are unrelated values. So for example say I have this:

ABCD
10207FALSE
3540150TRUE
506048FALSE
708015TRUE
100200250FALSE

<tbody>
</tbody>

D2 is TRUE because C2 is between a pair of values in A and B (A5-B5, 100-200).
D4 is TRUE because C4 is between a pair of values in A and B (A1-B1, 10-20).
The rest are FALSE because they don't fall within any of the value pairs.

Is that more clear?
 
Upvote 0
You're welcome, if a value in C is = to A or B it doesn't say true, if you want it to, simply add = into the formula,

=IF(COUNTIFS($A$1:$A$30,"<="&C1,$B$1:$B$30,">="&C1),"True","")
 
Upvote 0

Forum statistics

Threads
1,213,497
Messages
6,113,998
Members
448,539
Latest member
alex78

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top