Home > Back-end >  So I'm trying to stack up some =if(and( functions in excel, I can't seem to find the probl
So I'm trying to stack up some =if(and( functions in excel, I can't seem to find the probl

Time:06-13

=IF(AND(F2=N2;G2>O2);"No Notificar";"Notificar";IF(AND(F2=N3;G2>O3);"No Notificar";"Notificar";IF(AND(F2=N4;G2>O4);"No Notificar";"Notificar";IF(AND(F2=N5;G2>O5);"No Notificar";"Notificar";IF(AND(F2=N6;G2>O6);"No Notificar";"Notificar";IF(AND(F2=N7;G2>O7);"No Notificar";"Notificar")))))

CodePudding user response:

IF has only 3 parameters.

Your consecutive IF should be the 3rd parameter, there is no 4th parameter in this formula.

CodePudding user response:

As @KromeWing said - you've entered too many parameters for an IF formula.

It should have a logical calculation that would return TRUE/FALSE and then what to do if it's TRUE and what to do if it's FALSE.

Currently your formula reads as:

=IF(AND(F2=N2,G2>O2),"No Notificar","Notificar",
   IF(AND(F2=N3,G2>O3),"No Notificar","Notificar",
   IF(AND(F2=N4,G2>O4),"No Notificar","Notificar",
   IF(AND(F2=N5,G2>O5),"No Notificar","Notificar",
   IF(AND(F2=N6,G2>O6),"No Notificar","Notificar",
   IF(AND(F2=N7,G2>O7),"No Notificar","Notificar")))))  

It should look more like:

=IF(AND(F2=N2,G2>O2),"No Notificar",
IF(AND(F2=N3,G2>O3),"No Notificar",
IF(AND(F2=N4,G2>O4),"No Notificar",
IF(AND(F2=N5,G2>O5),"No Notificar",
IF(AND(F2=N6,G2>O6),"No Notificar",
IF(AND(F2=N7,G2>O7),"No Notificar","Notificar"))))))

So if the first equation is TRUE it will show No Notificar, otherwise it will test the second equation. If all equations return FALSE then it will return Notificar.

CodePudding user response:

You are expecting IF() to accept four arguments instead of three.

I often get messed up by nested ifs, too, and it's usually from having to think too hard.

To make things easier on yourself, both today and next month when you come back to this and have to try to figure out what the heck you were trying to do, try using alt-enter to add a new line within your formula, allowing you to format your formula like this:

=IF(test, valueIfTest,
IF(test2, valueIfTest2,
IF(test3, valueIfTest3,
...
valueIfAllTestsFail
)))

I find that as long as I stick to this format, the hardest part of the syntax is reduced to having the right number of closing parentheses at the end, but thanks to how Excel color-codes matching parentheses, I can manage that even when I'm caffeine-deprived!

  • Related