IF OR Statement Too Many Arguments Error

easybpw

Active Member
Joined
Sep 30, 2003
Messages
439
Office Version
  1. 365
  2. 2013
Platform
  1. Windows
Hello,

Thanks in advance for any help. I never have understood completely what it means by "arguments". I have this formula below that gives me an error saying too many arguments when I initially am building the formula/ What am I doing wrong and what exactly is an argument and how do you know when you have too many?

=IF(OR(A7="Profit",A7="Loss"),VLOOKUP(D7,'Statements'!$A$4:$T$35,10,0,VLOOKUP(D7,'Statements'!$A$4:$T$35,12,0))

Thanks!

Bill
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
"Arguments" are like "Inputs".
For example, the VLOOKUP formula has four "Inputs", separated by commas (the last one is optional, so you can actually get away with three).

However, your VLOOKUP shows way too many, as you don't close off the first VLOOKUP with a right parenthesis before starting the next VLOOKUP.
So, it is saying that the first VLOOKUP has too many arguments.
It should be:
Code:
=IF(OR(A7="Profit",A7="Loss"),VLOOKUP(D7,Statements!$A$4:$T$35,10,0[COLOR=#ff0000])[/COLOR],VLOOKUP(D7,Statements!$A$4:$T$35,12,0))
 
Upvote 0
You're not ending your first VLOOKUP with a Parenthesis.

=IF(OR(A7="Profit",A7="Loss"),VLOOKUP(D7,Statements!$A$4:$T$35,10,0),VLOOKUP(D7,Statements!$A$4:$T$35,12,0))

Arguments are the values you pass to a function.
 
Upvote 0
Hi there! Thanks again for the help.

I did exactly what you show prior to posting my question but the formula returned the same result for "Loss" as it did Profit". The formula is not taking into consideration the "OR" portion, if that makes any sense. Using an OR I expected two different results. I expected if A7 was Profit that it would find column 10 on the "Statements sheet, which it does. But when A7 is "Loss" it still returns the same result as if it's "Statement".
 
Upvote 0
Hi there! Thanks again for the help.

I did exactly what you show prior to posting my question but the formula returned the same result for "Loss" as it did Profit". The formula is not taking into consideration the "OR" portion, if that makes any sense. Using an OR I expected two different results. I expected if A7 was Profit that it would find column 10 on the "Statements sheet, which it does. But when A7 is "Loss" it still returns the same result as if it's "Statement".

The OR function is testing those values, in your case A7="profit" or A7="loss" if either is true then the OR statement is true. Can A7 only be Profit or Loss, or can it also be other values?

If it can only be Profit or Loss try this:
Code:
[COLOR=#333333]=IF(A7="Profit",VLOOKUP(D7,Statements!$A$4:$T$35,10,0),VLOOKUP(D7,Statements!$A$4:$T$35,12,0))[/COLOR]
 
Upvote 0
I think you are misunderstanding how the formula you structured works.
The way that OR works, is if either of the two conditions you listed is TRUE, the whole thing evaluates to TRUE.
So the way you have written the formula, "Profit" and "Loss" SHOULD return the exact same value!

What you formula says is the following:
If A7 is "Profit" or "Loss", then run: VLOOKUP(D7,Statements!$A$4:$T$35,10,0)
The only way the second VLOOKUP is run if is something other than "Profit" or "Loss" appears in A7.

If you want the first VLOOKUP to go with "Profit", and the second VLOOKUP to go with "Loss", then you either need a nested IF formula like this:
Code:
=IF(A7="Profit",VLOOKUP(D7,Statements!$A$4:$T$35,10,0),IF(A7="Loss",VLOOKUP(D7,Statements!$A$4:$T$35,12,0),0))
or two IF statements added together like this:
Code:
=IF(A7="Profit",VLOOKUP(D7,Statements!$A$4:$T$35,10,0),0) + IF(A7="Loss",VLOOKUP(D7,Statements!$A$4:$T$35,12,0),0)
 
Upvote 0
Ahhh yes i am not understanding the formula properly. Thank you very much!
 
Upvote 0
One last question, now that i think I understand the formula better, how do I eliminate the "FALSE" responses if A7 is neither "Profit" or "Loss"? The desired response is to have the cell empty.
 
Upvote 0
One last question, now that i think I understand the formula better, how do I eliminate the "FALSE" responses if A7 is neither "Profit" or "Loss"? The desired response is to have the cell empty.
Neither of the two formulas I posted would return FALSE, they would return 0.
If you are still using an IF formula, note that there are three arguments:
=IF(condition, what to return if true, what to return if false)
If you leave the third argument off, it will simply return the word "FALSE" if the condition is not met, as you did not tell it to return anything in the FALSE argument.
To return a blank, you would just structure it like:
=IF(condition, what to return if true, "")

If your formula doesn't look like that and you are having trouble figuring out how to get rid of the FALSE, please post the formula that you are currently using.
 
Upvote 0
If it's saying FALSE, it means that that argument is missing from your function. But that is not the case in the proposed formula so you must have changed something. Try this:

=IF(A7="Profit",VLOOKUP(D7,Statements!$A$4:$T$35,10,0),IF(A7="Loss",VLOOKUP(D7,Statements!$A$4:$T$35,12,0),""))
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

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