Nested IF AND Statement

Kelly O

New Member
Joined
Jan 24, 2017
Messages
2
Good Afternoon,

I am using a nested IF AND statement to look at a salary, look at a range and then use the percentage associated with that range (hope that makes sense)

If I type the formula like this
=IF(AND($C17>=$n$2,$C17<=$o$2),$C17*$m$2,IF(AND($C17>=$n$3,$C17<=$o$3),$C17*$m$3,IF(AND($C17>=$n$4,$C17<=$o$4),$C17*$m$4,if(AND($c17>=$N$5,$c17<=$O$5,$c17*$M$5,if($c17>=$N$6,$c17*$M$6,"")))))
Excel tells me that there is an error

If I type it like this
=IF(AND($C17>=$n$2,$C17<=$o$2),$C17*$m$2,IF(AND($C17>=$n$3,$C17<=$o$3),$C17*$m$3,IF(AND($C17>=$n$4,$C17<=$o$4),$C17*$m$4,if(AND($c17>=$N$5,$c17<=$O$5,$c17*$M$5,if($c17>=$N$6,$c17*$M$6,""
Excel tells me my formula is missing a parenthesis. I have been staring at this for an hour - any help would be greatly appreciated

I have used the above formula in an earlier part of my sheet and it has 1 less AND statement and worked perfectly. Am I used too many AND Statements?
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
You dont need the ANDs. If N2:N6 is in ascending order then just use an IF on the highest value first, ie
=IF(C17>N6,M6,IF(C17>N5,M5,IF(C17>N4,M4,IF(C17>N3,M3,IF(C17>N2,M2,0)))))*C17

Or replace the entire formula with this

=INDEX(M$2:M$6,LOOKUP(C17,N$2:N$6))*C17

This assumes C17 will be >= to at least one of the salaries otherwise

=IF(C17>N2,INDEX(M$2:M$6,LOOKUP(C17,N$2:N$6))*C17,"")
 
Last edited:
Upvote 0

Forum statistics

Threads
1,216,217
Messages
6,129,567
Members
449,517
Latest member
Lsmich

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