If Formula Error

Mangesharalkar

New Member
Joined
Apr 27, 2016
Messages
10
Hi All,

Below is the data:

I am trying formula, but giving error:

=IF(AND(O5="I",P5="P-W",20%,IF(AND(O5="I",P5="P-H"),20%,IF(AND(O5="I",P5="I"),0%,IF(AND(O5="P-W",P5="I"),-20%,IF(AND(O5="P-W",P5="P-H",20%,IF(AND(O5=P-W,P5="K",20%,IF(AND(O5="P-W",P5="P-W",0%,IF(AND(O5="K",P5="CC",20%,IF(AND(O5="K",P5="K-R",-20%,IF(AND(O5="K-C",P5="K-C",0%,IF(AND(O5="P-H",P5="P-H",0%,IF(AND(O5="K",P5="C-C",20%,IF(AND(O5="P-H",P5="K",0%,IF(AND(O5="K",P5="K",0%,IF(AND(O5="CC",P5="CC",0%)

Error is - Formula Opening and closing is missing Parenthesizing

Week1Week2%
IP-W20%
IP-H20%
P-WI-20%
P-WP-H20%
P-WK20%
P-HK0%
KK-C10%
KCC20%
KK-R-20%
II0%
P-WP-W0%
P-HP-H0%
KK0%
K-CK-C0%
CCCC0%

<colgroup><col width="63" span="3" style="width:47pt"> </colgroup><tbody>
</tbody>
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
your missing brackets after the AND|()
AND(O5="I",P5="P-W"

=IF(AND(O5="I",P5="P-W",20%,IF(AND(O5="I",P5="P-H"),20%,IF(AND(O5="I",P5="I"),0%,IF(AND(O5="P-W",P5="I"),-20%,IF(AND(O5="P-W",P5="P-H",20%,IF(AND(O5=P-W,P5="K",20%,IF(AND(O5="P-W",P5="P-W",0%,IF(AND(O5="K",P5="CC",20%,IF(AND(O5="K",P5="K-R",-20%,IF(AND(O5="K-C",P5="K-C",0%,IF(AND(O5="P-H",P5="P-H",0%,IF(AND(O5="K",P5="C-C",20%,IF(AND(O5="P-H",P5="K",0%,IF(AND(O5="K",P5="K",0%,IF(AND(O5="CC",P5="CC",0%)

and a FALSE condition at the end and loads of brackets to close each IF

=IF(AND(O5="I",P5="P-W",20%,IF(AND(O5="I",P5="P-H"),20%,IF(AND(O5="I",P5="I"),0%,IF(AND(O5="P-W",P5="I"),-20%,IF(AND(O5="P-W",P5="P-H",20%,IF(AND(O5=P-W,P5="K",20%,IF(AND(O5="P-W",P5="P-W",0%,IF(AND(O5="K",P5="CC",20%,IF(AND(O5="K",P5="K-R",-20%,IF(AND(O5="K-C",P5="K-C",0%,IF(AND(O5="P-H",P5="P-H",0%,IF(AND(O5="K",P5="C-C",20%,IF(AND(O5="P-H",P5="K",0%,IF(AND(O5="K",P5="K",0%,IF(AND(O5="CC",P5="CC",0%, "????"))))))))))))))))

for the same TRUE ie 20%
you could put in all one statement mixing OR () with AND()

for example
IF(AND(O5="I",P5="P-W" . =true = 20%
AND(O5="P-W",P5="P-H" . if true = 20%

so combine to
IF (OR(
AND(O5="I",P5="P-W"),AND(O5="P-W",P5="P-H")), 20% ,
and the other 20% can also be added to the OR
 
Last edited:
Upvote 0
try...
Code:
=IF(AND(O12="I",P12="P-W"),20%,IF(AND(O12="I",P12="P-H"),20%,IF(AND(O12="I",P12="I"),0%,IF(AND(O12="P-W",P12="I"),-20%,IF(AND(O12="P-W",P12="P-H"),20%,IF(AND(O12="P-W",P12="K"),20%,IF(AND(O12="P-W",P12="P-W"),0%,IF(AND(O12="K",P12="CC"),20%,IF(AND(O12="K",P12="K-R"),-20%,IF(AND(O12="K-C",P12="K-C"),0%,IF(AND(O12="P-H",P12="P-H"),0%,IF(AND(O12="K",P12="C-C"),20%,IF(AND(O12="P-H",P12="K"),0%,IF(AND(O12="K",P12="K"),0%,IF(AND(O12="CC",P12="CC"),0%)))))))))))))))
 
Upvote 0
If you have Excel 2016, you might want to look at the IFS function.
 
Upvote 0
bit shorter...
A VLOOKUP with ALL options listed might have been a better idea !!

Code:
=IF(AND(O5="I",OR(P5="P-W",P5="P-H")),20%,IF(AND(O5="I",P5="I"),0%,IF(AND(O5="P-W",OR(P5="I",P5="K")),-20%,IF(AND(O5="P-W",P5="P-H"),20%,IF(AND(O5="P-W",P5="P-W"),0%,IF(AND(O5="K",OR(P5="CC",P5="C-C")),20%,IF(AND(O5="K",P5="K-R"),-20%,IF(AND(O5="K-C",P5="K-C"),0%,IF(AND(O5="P-H",P5="P-H"),0%,IF(AND(O5="P-H",P5="K"),0%,IF(AND(O5="K",P5="K"),0%,IF(AND(O5="CC",P5="CC"),0%))))))))))))
 
Upvote 0
i just worked out ALL the OR() and AND()
reduced to 3 nested IFs

=IF(OR(AND(O5="I",P5="P-W"),AND(O5="I",P5="P-H"),AND(O5="P-W",P5="P-H"),AND(O5="P-W",P5="K"),AND(O5="K",P5="CC"),AND(O5="K",P5="C-C")),20%,IF(OR(AND(O5="I",P5="I"),AND(O5="P-W",P5="P-W"),AND(O5="K-C",P5="K-C"),AND(O5="P-H",P5="P-H"),AND(O5="P-H",P5="K"),AND(O5="K",P5="K"),AND(O5="CC",P5="CC")), 0%,
IF(OR( AND(O5="P-W",P5="I"),AND(O5="K",P5="K-R")),-20%,"not met" )))
 
Upvote 0

Forum statistics

Threads
1,214,973
Messages
6,122,534
Members
449,088
Latest member
RandomExceller01

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