Excel IF Function..too many arguments - excel

I'm trying to figure out what I am doing wrong with this formula. It is returning the error "you've entered too many arguments for this function"
=IF(ROUND(d28=0,0,IF(b28<=$B$19,0,IF(AND($B$18="Fixed Balloon",b28=$B$20),d28,G28-f28))))
Thanks for the help

Try it like this, putting ROUND(d28,1)=0 instead of ROUND(d28=0...
=IF(ROUND(d28,1)=0,0,IF(b28<=$B$19,0,IF(AND($B$18="Fixed Balloon",b28=$B$20),d28,G28-f28)))
To make this clearer, showing what is happening, type it out in a text document in an indented format:
=IF(ROUND(d28,1)=0,
0,
IF(b28<=$B$19,
0,
IF(AND($B$18="Fixed Balloon",b28=$B$20),
d28,
G28-f28
)
)
)
Edit: ROUND takes 2 parameters, the first being the number to round, and the second being the number of digits to round to. I choose to make it round to one digit.
This could equally be written like this, which I find makes it easier to understand:
=IF(OR(ROUND(D28,1)=0,B28<=$B$19),
0,
IF(AND($B$18="Fixed Balloon",B28=$B$20),
D28,
G28-F28
)
)

Related

Excel Len function based on condition

I have two columns in my excel file.
Full ID Expected Result
159473A1 159473
159696A1 159696
160614A1 160614
43293J1A 43293
43293D1A 43293
43293A2B 43293
43293J2B 43293
43293B2B 43293
What i had tried :
=Left(A2,LEN(A2)-2)
159473
159696
160614
43293J
43293D
43293A
43293J
43293B
53202
But has you can see, I cant do that because I still have some characters in the expected results
43293J
43293D
43293A
43293J
43293B
How can I get my expected results in like the top example?
In B2 try:
=LEFT(A2,MATCH(FALSE,INDEX(ISNUMBER(MID(A2,ROW(A$1:INDEX(A:A,LEN(A2))),1)*1),),0)-1)
If you have access to DA-functions (O365), like SEQUENCE:
=LEFT(A2,MATCH(FALSE,ISNUMBER(MID(A2,SEQUENCE(LEN(A2)),1)*1),0)-1)
Note: If you are dealing with integers too, maybe to prevent possible errors through MATCH, you could use =LEFT(A2,MATCH(FALSE,ISNUMBER(MID(A2&"A",SEQUENCE(LEN(A2)+1),1)*1),0)-1)
So, very simple in the first instance:
But you have an issue with line 4... so this will help that:
IF(ISNUMBER(VALUE(LEFT(A3,LEN(A3)-2))),VALUE(LEFT(A3,LEN(A3)-2)),VALUE(LEFT(A3,LEN(A3)-3)))
This formula will work for you , remember to click Ctrl+Shift+Enter after pasting formula as its a matrix based formula
mention your email i can send you my workout
=LEFT(A2,IFERROR(MATCH(1,ISERR(MID(A2,ROW(INDIRECT("1:"&LEN(A2))),1)*1)*1,),)-1)

I keep getting "you've entered too many arguments for this function" Why"

I keep getting
You've entered too many arguments for this function
Why?
=IF(
Home!O17=6,
Home!H17,
0,
IF(
Home!O17=2,
Home!H20,
0,
IF(
Home!O17=3,
Home!H23,
0,
IF(
Home!O17=4,
Home!H26,
0,
IF(
Home!O17=5,
Home!H29,
0
)
)
)
)
Because you're passing four arguments into a three argument function. In Excel, the function call is:
=IF (logical_test, [value_if_true], [value_if_false])
Based on the structure, I am guessing you want to remove every "0," to get down to three args. Something like so:
=IF(Home!O17=6,Home!H17,IF(Home!O17=2,Home!H20,IF(Home!O17=3,Home!H23,IF(Home!O17=4,Home!H26,IF(Home!O17=5,Home!H29,0))))
That said, I have no idea what this should accomplish and I'm just guessing that you wanted to daisy chain this. Maybe it's actually supposed to be entirely separate statements.
Try this out.
=IF(Home!O17=6,Home!H17,IF(Home!O17=2,Home!H20,IF(Home!O17=3,Home!H23,IF(Home!O17=4,Home!H26,IF(Home!O17=5,Home!H29,0)))))

VBA If statments run fine on their own but not together too many arguments

These IF statements run fine on their own and work, but together they give me too many arguments error?
=IF(AND(AND(G11="M2M+",L11="Single"),OR(J11>1180,K11>2430)),Rules!G24,Rules!G23, IF(AND(AND(G11="M2M+",L11="Double"),OR(J11>1180,K11>2430)),Rules!G27,Rules!G28))
http://imgur.com/PlUbJ9k
Image here of price layout..
An if function has 3 arguments (the indentation is just for explanation purpose):
IF( Arguments in IF
Something is True, (1)
then do something, (2)
otherwise do something else (3)
)
If we indent your function the same way, you will clearly see that there are too many arguments (4) in the first if.
=IF( Argument in IF
AND( (1)
AND(G11="M2M+",L11="Single"),
OR(J11>1180,K11>2430)
),
Rules!G24, (2)
Rules!G23, (3)
IF( (4)
AND(
AND(G11="M2M+",L11="Double"),
OR(J11>1180,K11>2430)
),
Rules!G27,
Rules!G28
)
)
You need to end the first if after 3 Arguments with a closing bracket. It's hard to tell how the correct function would look like because we don't know what you are trying to achieve.
There is a possibility that you might be looking for this:
=IF(AND(G11="M2M+",OR(J11>1180,K11>2430)), IF(L11="Single",Rules!G24,IF(L11="Double", Rules!G27, Rules!G28)), Rules!G23)

IF function for specific text strings

I am trying to write a formula that takes a word and process it through a IF function in excel, The Values are list in the formula. My issue right now is the fact that I have Large, X-Large and 1X-Large text. The X-Large and 1X-Large are unique strings and need the IF function to be able to differentiate the two.
Here is what i have so far.
=if(or(isnumber(search("Small",af2)),ISNUMBER(SEARCH("Medium",AF2)),ISNUMBER(SEARCH("Large",AF2)),,ISNUMBER(SEARCH("X-Large",AF2))),"Small",or(isnumber(search("1X-Large",af2)),isnumber(search("2X-Large",af2)),isnumber(search("3X-Large",af2)),isnumber(search("4X-Large",af2))),"1X-Large")
I cant understand why it's showing an error and only displays small when it works.
All help is appreciated
Your current formula shouldn't work, it should be giving you an error about having too many arguments. A breakdown of your function:
=if(
or(isnumber(search("Small",af2)),ISNUMBER(SEARCH("Medium",AF2)),ISNUMBER(SEARCH("Large",AF2)),,ISNUMBER(SEARCH("X-Large",AF2))),
"Small",
or(isnumber(search("1X-Large",af2)),isnumber(search("2X-Large",af2)),isnumber(search("3X-Large",af2)),isnumber(search("4X-Large",af2))),
"1X-Large"
)
You cannot use 4 parameters in an IF. You need to have a maximum of 3. Maybe what you meant was:
=if(
or(isnumber(search("Small",af2)),ISNUMBER(SEARCH("Medium",AF2)),ISNUMBER(SEARCH("Large",AF2)),,ISNUMBER(SEARCH("X-Large",AF2))),
"Small",
IF(
or(isnumber(search("1X-Large",af2)),isnumber(search("2X-Large",af2)),isnumber(search("3X-Large",af2)),isnumber(search("4X-Large",af2))),
"1X-Large"
)
)
But that doesn't solve your issue about the X-Large part. To cater for that, you can check whether the X-Large series exist first, then the others.
=IF(
OR(ISNUMBER(SEARCH("1X-Large",AF2)),ISNUMBER(SEARCH("2X-Large",AF2)),ISNUMBER(SEARCH("3X-Large",AF2)),ISNUMBER(SEARCH("4X-Large",AF2))),
"1X-Large",
IF(
OR(ISNUMBER(SEARCH("Small",AF2)),ISNUMBER(SEARCH("Medium",AF2)),ISNUMBER(SEARCH("Large",AF2)),ISNUMBER(SEARCH("X-Large",AF2))),
"Small"
)
)
Although you can make it shorter with this:
=IF(
OR(ISNUMBER(SEARCH({"1X-Large","2X-Large","3X-Large","4X-Large"},AF2))),
"1X-Large",
IF(
OR(ISNUMBER(SEARCH({"Small","Medium","Large","X-Large"},AF2))),
"Small"
)
)
In one line...
=IF(OR(ISNUMBER(SEARCH({"1X-Large","2X-Large","3X-Large","4X-Large"},AF2))),"1X-Large",IF(OR(ISNUMBER(SEARCH({"Small","Medium","Large","X-Large"},AF2))),"Small"))

Comparing two string values with an if statement

I am using excel 2010 and want to give out 1 if it's true and 0 if it's false for a given string.
I tried:
=IF((EXACT(G2;"V") OR EXACT(G2;"K"));"1";"0")
However, this always gives me an error.What's wrong with this formula?
I appreciate your replies!
That's not how you use the OR formula. Try this:
=IF(OR(EXACT(G2;"V");EXACT(G2;"K"));"1";"0")
It is indeed:
OR(Test; Test; Test; ...)
Note:
I'm not sure why you used "1" and "0", but you can drop the quotes if you don't mind having numbers.
You might also simply use:
=OR(EXACT(G2;"V");EXACT(G2;"K"))
To get the result as TRUE or FALSE, or if you want to get 1 or 0...
=OR(EXACT(G2;"V");EXACT(G2;"K"))*1

Resources