Formula for Greater/Less Than

DanPV

New Member
Joined
Apr 1, 2011
Messages
4
It seems I have a simple problem however I have tried an If Statement, Vlookup, and an Index formula to no avail. What I am trying to accomplish is retrieve data from a table that has three columns - all numeric. The formula I want is to say if cell A1 is greater than column one and less than column two, return column three. The IF statement below does not work:
<TABLE style="WIDTH: 48pt; BORDER-COLLAPSE: collapse" cellSpacing=0 cellPadding=0 width=64 border=0><COLGROUP><COL style="WIDTH: 48pt" width=64><TBODY><TR style="HEIGHT: 15pt" height=20><TD id=td_post_1505372 style="BORDER-RIGHT: #ffffff; BORDER-TOP: #ffffff; BORDER-LEFT: #ffffff; WIDTH: 48pt; BORDER-BOTTOM: #ffffff; HEIGHT: 15pt; BACKGROUND-COLOR: transparent" width=64 height=20>=IF(A4>=$A$16,D16,IF(A4<=$B$16,D16,IF(A4>=$A$17,D17,IF(A4<=$B$17,D17,IF(A4>=$A$18,D18,IF(A4<=$B$18,D18))))))</TD></TR></TBODY></TABLE>
Thank you,
-D
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Welcome to MrExcel board....

try something like this

=IF(AND(A4> =$A$16,A4< =$B$16),D16,D18)
 
Upvote 0
Does this work?
Code:
=IF(AND(A4>=A16, A4<=B16),D16,IF(AND(A4>=A17, A4<=B17),D17,D18))
You haven't given the case when A4 doesn't fit any of the categories (i.e. it's not inbetween A16 and B16 or A17 and B17 or A18 and B18)
 
Upvote 0
The result is not consistent - see below:

Table:

800 1000 45000
1100 1500 50000
1600 2000 60000

Result:

895 45000
1200 50000
1700 60000
900 0

Or if I absolute the cell it returns 45000,45000,45000,60000

Thanks
-D
 
Upvote 0
Looks like...

Control+shift+enter, not just enter:

=INDEX($D$16:$D$18,MATCH(1,IF($A$16:$A$18>=$A4,IF($A4<=$B$16:$B$18,1)),0))
 
Upvote 0
My formula returns the same values as the first three you have posted but for 900 returns 45000, i.e.:

895 - 45000
1200 - 50000
1700 - 60000
900 - 45000
 
Upvote 0
I added another If/And at the end to satisfy the last row and it worked. I appreciate the help.
 
Upvote 0

Forum statistics

Threads
1,224,600
Messages
6,179,836
Members
452,947
Latest member
Gerry_F

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