IF Function with greater than and less than

daisymoschop

New Member
Joined
Oct 8, 2014
Messages
4
Hi, I'm trying to get this IF function to work, it's not giving out an error message but using the wrong figure to do the calculation. Checked all the reference cells and can't work out what is going on with it!
[h=3]=IF(H3=1, G3*T3, IF(H3=2, U4*U3, IF(H3=3, V4*V3, IF(H3=4, W4*W3, IF(H3=5, X4*X3, IF(H3=6, Y4*Y3, IF(H3=7, Z4*Z3, IF(H3=8, AA4*AA3, IF(H3=9, AB4*AB3, IF(H3=10, AC4*AC3, IF(20 < H3 > 10, AD4*H3, IF(50 < H3 > 21, AE4*H3, IF(H3 > 51, AF4*H3, 0)))))))))))))

It all works fine for any values of H3 <20
However, when H3>20 it's using the wrong number to multiple H3 by.
AD4 = 1.5, AE4 = 1.1 and AF4= 0.87; for anything above H3=20, it's using 1.5 as the multiplier for all calcs and not applying the other rules.

For example - For 25, it should be giving an answer of 27.5 (If H3>20 = AE4*H3 = 1.1*25 = 27.5), it's actually giving 37.5.
I can only assume it's doing the calculation - AD4*H3 = 1.5 * 25 = 37.5

Any help will be much appreciated! :)
[/h]
 
Last edited:

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
I'm not very clued up with functions BUT my 'gut' is telling me that the problem lies in 'reading' in both directions ... :confused:

=IF(H3=1, G3*T3, IF(H3=2, U4*U3, IF(H3=3, V4*V3, IF(H3=4, W4*W3, IF(H3=5, X4*X3, IF(H3=6, Y4*Y3, IF(H3=7, Z4*Z3, IF(H3=8, AA4*AA3, IF(H3=9, AB4*AB3, IF(H3=10, AC4*AC3, IF(20 < H3 > 10, AD4*H3, IF(50 < H3 > 21, AE4*H3, IF(H3 > 51, AF4*H3, 0)))))))))))))

Try changing the red highlighted parts to read in one direction only (like the rest of your IF statements) ..

Hi, I'm trying to get this IF function to work, it's not giving out an error message but using the wrong figure to do the calculation. Checked all the reference cells and can't work out what is going on with it!
=IF(H3=1, G3*T3, IF(H3=2, U4*U3, IF(H3=3, V4*V3, IF(H3=4, W4*W3, IF(H3=5, X4*X3, IF(H3=6, Y4*Y3, IF(H3=7, Z4*Z3, IF(H3=8, AA4*AA3, IF(H3=9, AB4*AB3, IF(H3=10, AC4*AC3, IF(20 < H3 > 10, AD4*H3, IF(50 < H3 > 21, AE4*H3, IF(H3 > 51, AF4*H3, 0)))))))))))))

It all works fine for any values of H3 <20
However, when H3>20 it's using the wrong number to multiple H3 by.
AD4 = 1.5, AE4 = 1.1 and AF4= 0.87; for anything above H3=20, it's using 1.5 as the multiplier for all calcs and not applying the other rules.

For example - For 25, it should be giving an answer of 27.5 (If H3>20 = AE4*H3 = 1.1*25 = 27.5), it's actually giving 37.5.
I can only assume it's doing the calculation - AD4*H3 = 1.5 * 25 = 37.5

Any help will be much appreciated! :)
 
Upvote 0
Change
IF(20 < H3 > 10
to
IF(AND(H3 > 10,H3 < = 21)

And change
IF(50 < H3 > 21
to
IF(AND(H3 > 21,H3 < = 51)
 
Upvote 0

Forum statistics

Threads
1,215,679
Messages
6,126,183
Members
449,296
Latest member
tinneytwin

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