Dec 05 2023 12:25 PM
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
Dec 05 2023 12:48 PM
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
Dec 05 2023 12:49 PM
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%,""))))
Dec 05 2023 12:55 PM
Solution@Hans Vogelaar This works! Thank you so much! And now makes much more sense. Have a wonderful day.
Dec 05 2023 12:56 PM
Dec 05 2023 01:05 PM
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))
)
Dec 05 2023 02:00 PM
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%
)
Dec 05 2023 12:55 PM
Solution@Hans Vogelaar This works! Thank you so much! And now makes much more sense. Have a wonderful day.