Forum Discussion
Kristie365
Dec 05, 2023Copper Contributor
Excel Formula Error - Too Many Arguments - Comma or Parenthesis Error?
Greetings,
I am trying to create the following formula -
=IF(F2=$P$2,IF(M2>0.6,3%,IF(M2>0.5,2%,IF(M2>0.4,1%,IF(M2>0.3,0%)))),IF(F2=$P$4,IF(M2>0.6,3%,IF(M2>0.5,2%,IF(M2>0.4,1%,IF(M2>0.3,0%)))),IF(F2=$P$3,3%)),if(F2=P5,1%))
I keep returning too many arguments error - I've tried my best to adjust commas/parenthesis in a logical way to alleviate, but cannot figure it out!
If I remove the final portion of the formula, it returns the correct information and reads the formula correctly:
=IF(F2=$P$2,IF(M2>0.6,3%,IF(M2>0.5,2%,IF(M2>0.4,1%,IF(M2>0.3,0%)))),IF(F2=$P$4,IF(M2>0.6,3%,IF(M2>0.5,2%,IF(M2>0.4,1%,IF(M2>0.3,0%)))),IF(F2=$P$3,3%)))
However, I need that final formula (IF(F2=P5,1%) added to make the formula usable for my workbook.
Please let me know if anyone knows what I'm missing or sees a resolution.
Thank you
HansVogelaar This works! Thank you so much! And now makes much more sense. Have a wonderful day.
6 Replies
Sort By
- PeterBartholomew1Silver Contributor
Since you are catering for 4 options for $P$2, IF was always going to be a mess. SWITCH caters for any number of conditions and could be read more easily. The percentages returned for various values of $M$2 are probably best looked up from a table but IFS would also offer a reasonably clear syntax
= SWITCH($F$2, $P$2, IFS($M$2>0.6, 3%, $M$2>0.5, 2%, $M$2>0.4, 1%, $M$2>0.3, 0%), $P$4, IFS($M$2>0.6, 3%, $M$2>0.5, 2%, $M$2>0.4, 1%, $M$2>0.3, 0%), $P$3, 3%, $P$5, 1% )
- Patrick2788Silver Contributor
I'm a bit late to the show but I'll offer SWITCH as an alternative to simplify things.
=LET( rates, {0, 0; 0.4, 0.01; 0.5, 0.02; 0.6, 0.03}, SWITCH(F2, P3, 3%, P5, 1%, VLOOKUP(M2, rates, 2)) )
Try this:
=IF(F2=$P$2,IF(M2>0.6,3%,IF(M2>0.5,2%,IF(M2>0.4,1%,IF(M2>0.3,0%,"")))),IF(F2=$P$4,IF(M2>0.6,3%,IF(M2>0.5,2%,IF(M2>0.4,1%,IF(M2>0.3,0%,"")))),IF(F2=$P$3,3%,IF(F2=$P$5,1%,""))))
- Kristie365Copper Contributor
HansVogelaar This works! Thank you so much! And now makes much more sense. Have a wonderful day.
- LorenzoSilver Contributor
Hi Kristie365
This doesn't raise any error but you miss a value_if_false in your last nested IF
=IF(F2 = $P$2, IF(M2 > 0.6, 3%, IF(M2 > 0.5, 2%, IF(M2 > 0.4,1%, IF(M2 >0.3,0%, IF(F2 = $P$4, IF(M2 > 0.6,3%, IF(M2 > 0.5,2%, IF(M2 >0.4, 1%, IF( M2 > 0.3,0%, IF(F2 = $P$3, 3%, IF(F2 = P5, 1%, "ELSE WHAT?") ) ) ) ) ) ) ) ) ) ) )
TBH I didn't try to understand what this formula is supposed to do as it looks scary to me. My suggestion would be that you follow the recommendations in Welcome to your Excel discussion space! as there's probably a better way to do what you expect. Hope this makes sense & helps in the meantime
- Kristie365Copper ContributorThank you for the response! The below formula correction works 🙂 Have a nice day