# Nested IF functions error message

#### excelrocksmysocks

##### New Member
My nested if function returns the error message "too many arguments" even though there are only 4. If someone can help edit my function that'd be great.
This is my final formula
=IF((AND(B\$1<=150,\$A2<=100)),(16.88*\$A2+20.99*B\$1)-(8.7*\$A2+11.51*B\$1),IF((AND(B\$1>=150,\$A2>=100)),(16.88*\$A2+20.99*B\$1)-(8.7*\$A2+11.51*B\$1)),IF((AND(B\$1>150,\$A2<100)),((16.88*\$A2+20.99*350+(MIN(B\$1-150,100-\$A2))*0.42*20.99)-(8.7*\$A2+11.51*B\$1)),IF((AND(B\$1<150,\$A2>100)),((16.88*100+20.99*B\$1+(MIN(\$A2-100,150-B\$1))*0.75*16.88)-(8.7*\$A2+11.51*B\$1)))))

### Excel Facts

Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.

#### Anand Sharma

##### Board Regular
Hi

Try using below formula and change the result multiplication and adding values as I changed structure of formula only

=IF(AND(B\$1<=150,\$A2<=100), ((16.88*\$A2)+(20.99*B\$1)) - ((8.7*\$A2)+(11.51*B\$1)),
IF(AND(B\$1>=150,\$A2>=100), ((16.88*\$A2)+(20.99*B\$1)) - ((8.7*\$A2)+(11.51*B\$1)),
IF(AND(B\$1>150,\$A2<100), ((16.88*\$A2)+(20.99*B\$1)) - ((8.7*\$A2)+(11.51*B\$1)),
IF(AND(B\$1<150,\$A2>100), ((16.88*\$A2)+(20.99*B\$1)) - ((8.7*\$A2)+(11.51*B\$1)), ""))))

#### LateralThinker

##### New Member
Try this
=IF(AND(B\$1<=150,\$A2<=100),(16.88*\$A2+20.99*B\$1)-(8.7*\$A2+11.51*B\$1),
IF(AND(B\$1>=150,\$A2>=100),(16.88*\$A2+20.99*B\$1)-(8.7*\$A2+11.51*B\$1),
IF(AND(B\$1>150,\$A2<100),((16.88*\$A2+20.99*350+(MIN(B\$1-150,100-\$A2))*0.42*20.99)-(8.7*\$A2+11.51*B\$1)),
IF(AND(B\$1<150,\$A2>100),((16.88*100+20.99*B\$1+(MIN(\$A2-100,150-B\$1))*0.75*16.88)-(8.7*\$A2+11.51*B\$1))))))

Last edited:

Replies
2
Views
559
Replies
4
Views
437
Replies
2
Views
1K
Replies
0
Views
331
Replies
4
Views
476 Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

### Forum statistics

1,163,542
Messages
5,832,346
Members
430,128
Latest member
ojl987 ### 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.

### Which adblocker are you using?    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

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