Home > Mobile >  Wrong number of arguments to IF. Expected between 2 and 3 arguments, but got 19 arguments
Wrong number of arguments to IF. Expected between 2 and 3 arguments, but got 19 arguments

Time:08-27

=(IF(or(E3="Kalyan",E3="Prescribe",E3="Ucook"),"Ram Varan",IF(E3="Mr.Cook",E3="Lifelong",E3="Kimatsu"),"Jay Kumar",IF(E3="Candes",E3="Aahar"),"Aanirudh",IF(E3="Anticware",E3="Suryakraft"),"pradeep",IF(E3="Pexpo",E3="Big plastic"),"Ashish",IF(E3="Cello",E3="Crompton"),"Bhupender",IF(E3="Kirvan"),"Rakesh",IF(E3="Rajkamal"),"Nilesh",IF(E3="Kanak Bandhan"),"Mayank",IF(E3="Rajkamal")"Abhishek",IF(E3="Pigeon"),"Shantanu",IF(E3="Prestige"),"Gaurav",IF(E3="Avais"),"Pushp"))

How do I solve this error

CodePudding user response:

=IF(OR(E3="Kalyan",E3="Prescribe",E3="Ucook"),"Ram Varan",
IF(OR(E3="Mr.Cook",E3="Lifelong",E3="Kimatsu"),"Jay Kumar",
IF(OR(E3="Candes",E3="Aahar"),"Aanirudh",
IF(OR(E3="Anticware",E3="Suryakraft"),"pradeep",
IF(OR(E3="Pexpo",E3="Big plastic"),"Ashish",
IF(OR(E3="Cello",E3="Crompton"),"Bhupender",
IF(E3="Kirvan","Rakesh",
IF(E3="Rajkamal","Nilesh",
IF(E3="Kanak Bandhan","Mayank",
IF(OR(E3="Rajkamal","Abhishek"),
IF(E3="Pigeon","Shantanu",
IF(E3="Prestige","Gaurav",
IF(E3="Avais","Pushp","")))))))))))))

CodePudding user response:

=(IF(OR(E3="Kalyan",E3="Prescribe",E3="Ucook"),
     "Ram Varan",
     IF(OR(E3="Mr.Cook",E3="Lifelong",E3="Kimatsu"),
        "Jay Kumar",
        IF(OR(E3="Candes",E3="Aahar"),
           "Aanirudh",
           IF(OR(E3="Anticware",E3="Suryakraft"),
              "pradeep",
              IF(OR(E3="Pexpo",E3="Big plastic"),
                 "Ashish",
                 IF(OR(E3="Cello",E3="Crompton"),
                    "Bhupender",
                    IF(E3="Kirvan",
                       "Rakesh",
                       IF(E3="Rajkamal",
                          "Nilesh",
                          IF(E3="Kanak Bandhan",
                             "Mayank",
                             IF(E3="Rajkamal",
                                "Abhishek",
                                IF(E3="Pigeon",
                                   "Shantanu",
                                   IF(E3="Prestige",
                                      "Gaurav",
                                      IF(E3="Avais",
                                      "Pushp"))))))))))))))

The problem here is not how to give you the solution, but to explain you how to obtain it.
As you can see, I have created indenting for the different levels inside your if-loop. Next to that, there were also some issues with the brackets (like IF(E3="Kirvan"), the closing bracket should not be there). However, every =OR() should be closed by a bracket.
I would advise you to use a text editor (like Notepad in this case), which shows the correspondence between brackets (while putting the cursor at one bracket, it gets shown in red and the corresponding bracket (if present) too, this allows you to check if the correspondence between the brackets is complete and correct, as you can see in the screenshot (the green rectangles show two corresponding brackets:

enter image description here

CodePudding user response:

Just as an example of a different approach:

IFERROR(VLOOKUP(K3,$D$2:$E$22,2,0),"Not in list")

enter image description here

I prefer this, as I avoid nesting more that 3 or 4 if() as it just gets too complicated.

Having a list is easier to control and you will note that you have "Rajkamal" with two different results for you to check.

  • Related