=IF(
( AND(
'Subject Teachers'!X4 <> "",
'Subject Teachers'!T4 >= 70
) ),
'Subject Teachers'!T4,
'Subject Teachers'!R4,
IF(
( AND(
'Subject Teachers'!R4 <> "",
'Subject Teachers'!O4 >= 70
) ),
'Subject Teachers'!O4,
'Subject Teachers'!L4,
IF(
( AND(
'Subject Teachers'!L4 <> "",
'Subject Teachers'!I4 >= 70
) ),
'Subject Teachers'!I4,
"N/A"
)
)
)
You have to many in the first IF statement. an if statement has 3 sections. The test, result if true and result if false. Your statement continues after the result is false.
Generic if statement example:
if(, , )
You have added an and statement in the . That goes from AND('Subject Teachers'!X4<>"",'Subject Teachers'!T4>=70)). So if x4 is not blank and t4 is greater than or equal to 70 then true else fase. Your statement has if the and statement is true then make it equal the value in 'Subject Teachers'!T4.
However if it is false make it equal to 'Subject Teachers'!T4. That should be the end. However you have another if statement beginning.
Depending what you are trying to do you should place the next if statement in the true section or the false section.
You can make your formula "work" by removing the "else/otherwise" results from the first two IFs, like this:
=IF(AND('Subject Teachers'!X4<>"",'Subject Teachers'!T4>=70),'Subject Teachers'!T4,IF(AND('Subject Teachers'!R4<>"",'Subject Teachers'!O4>=70),'Subject Teachers'!O4,IF(AND('Subject Teachers'!L4<>"",'Subject Teachers'!I4>=70),'Subject Teachers'!I4,"N/A")))
That removes the results L4 and R4.
The original formula is impossible because it says, for example, "if X then do THIS, otherwise do THIS, and if Y then do THIS, otherwise do THIS, and if Z then do THIS, otherwise do THIS". See, there are three results from that statement - it can't return a single answer. A typical nested IF formula goes "if X then do THIS, otherwise if Y then do THIS, otherwise if Z then do THIS, otherwise do THIS". That's what the edited formula above does.
Alternatively, if you do want all three results then you can nest the results together, like this:
=IF(AND('Subject Teachers'!X4<>"",'Subject Teachers'!T4>=70),'Subject Teachers'!T4,'Subject Teachers'!R4)&"-"&IF(AND('Subject Teachers'!R4<>"",'Subject Teachers'!O4>=70),'Subject Teachers'!O4,'Subject Teachers'!L4)&"-"&IF(AND('Subject Teachers'!L4<>"",'Subject Teachers'!I4>=70),'Subject Teachers'!I4,"N/A")
This simply combines the three results, separated by hyphens. So the result would be something like 80-90-50.
Related
When I try to check OR condition in Spark where function, the second condition is executed even thought first condition is true.
How can I skip the check of second condition?
df.
...
.where(
(
lit(lastLoadingDate).isNull
.or(
col(srcDTTM) > lastLoadingDate.format(formatterDTTM)
)
)
&& col(SrcDTTM) <= currentLoadingDate.format(formatterDTTM)
)
I tried even check next expression:
df.
...
.where(
(
lit(true)
.or(
col(srcDTTM) > lastLoadingDate.format(formatterDTTM)
)
)
&& col(SrcDTTM) <= currentLoadingDate.format(formatterDTTM)
)
But second condition:
col(srcDTTM) > lastLoadingDate.format(formatterDTTM)
is always executed.
Skip the check of second condition may result in incomplete data, because it is or judgment. If the second condition is true and the first condition is false, the amount of data in the result set will increase.
Checking the second condition in OR judgement wont make any difference when the first condition is true. Assume adding another condition or using any other function to skip the second condition check. If first check is false then condition to check if first one is true or false and then going to the second part of OR judgement. It will be like 3 conditions instead of 2. Its better to use OR judgement as it is.
I am new to Sharepoint. I want to create a validation rule in column validation to validate the given email address. Here is my code:
=AND(
ISERROR(FIND(” “, [Email],1)),
IF(ISERROR(FIND(“#”, [Email],2)),
FALSE,
AND(
ISERROR(FIND(“#”,[Email], FIND(“#”, [Email],2)+1)),
IF(ISERROR(FIND(“.”, [Email], FIND(“#”, [Email],2)+2)),
FALSE,
FIND(“.”, [Email], FIND(“#”, [Email],2)+2) < LEN([Email])
)
)
)
)
but the "ISERROR" function does not work and i get a syntax error. My column name is: Email and the type is: Single line of text
Per test, your code works fine on my environment.
Please make sure one thing: please use double quotes with English characters in the validation. It should be "" instead of “”.
=AND(
ISERROR(FIND(" ", [Email],1)),
IF(ISERROR(FIND("#", [Email],2)),
FALSE,
AND(
ISERROR(FIND("#",[Email], FIND("#", [Email],2)+1)),
IF(ISERROR(FIND(".", [Email], FIND("#", [Email],2)+2)),
FALSE,
FIND(".", [Email], FIND("#", [Email],2)+2) < LEN([Email])
)
)
)
)
Excel is throwing an error with my formula:
You have entered too many arguments for this function.
IF(AND(J2="Ounces",K2<=5),VLOOKUP(D2,'Parcel Select oz Lightweight'!$A$2:$B$17,2,0),IF(AND(J2="Ounces",K2>5),VLOOKUP(D2,'First Class oz'!$A$2:$B$17,2,0)),IF(AND(J2="Pounds",K2<=5),INDEX('lb and zones select'!$A$2:$K$73,MATCH(D2,'lb and zones select'!$A$2:$A$73,0),MATCH(H2,('lb and zones select'!$A$2:$K$2))),IF(AND(J2="Pounds",K2>5),INDEX('lbs and zones priority'!$A$2:$K$73,MATCH(D2,'lbs and zones priority'!$A$2:$A$73,0),MATCH(H2,'lbs and zones priority'!$A$2:$K$2,0)))))
I know its a really ugly formula.
As per your code, It looks like you just need to use parenthesis properly for each part to all if.
Normal If Block looks like this:
IF ( CONDITION,
<TRUE STATEMENT>,
<FALSE STATEMENT>
)
For nested statements or if, utilize parenthesis.
Put all nested true and false statement part in parenthesis:
IF ( CONDITION,
(<TRUE STATEMENT>),
(<FALSE STATEMENT>)
)
In this way your code can be look like this:
IF ( AND(J2="Ounces",K2<=5),
(VLOOKUP(D2,'Parcel Select oz Lightweight'!$A$2:$B$17,2,0)),
(IF(AND(J2="Ounces",K2>5),
(VLOOKUP(D2,'First Class oz'!$A$2:$B$17,2,0)),
(IF(AND(J2="Pounds",K2<=5),
(INDEX('lb and zones select'!$A$2:$K$73,MATCH(D2,'lb and zones select'!$A$2:$A$73,0),MATCH(H2,('lb and zones select'!$A$2:$K$2)))),
(IF(AND(J2="Pounds",K2>5),
(INDEX('lbs and zones priority'!$A$2:$K$73,MATCH(D2,'lbs and zones priority'!$A$2:$A$73,0),MATCH(H2,'lbs and zones priority'!$A$2:$K$2,0))),
(<Put a false part here, it was missing your code>)
))
))
))
)
Please check diff for above code and your code to get in detail about where you have missed the opening or closing of parenthesis.
If you break your code out with indentation, you'll see that your first IF has 4 arguments (Condition, True Statement, False Statement, Too Many Statements) and your second & fourth IFs only have 2 arguments:
=IF(
AND(J2="Ounces",K2<=5), //Condition
VLOOKUP(D2,'Parcel Select oz Lightweight'!$A$2:$B$17,2,0), //True
IF( //False
AND(J2="Ounces",K2>5), //Condition
VLOOKUP(D2,'First Class oz'!$A$2:$B$17,2,0) //True
), //No false?
IF( //Too many!
AND(J2="Pounds",K2<=5), //Condition
INDEX('lb and zones select'!$A$2:$K$73, //True
MATCH(D2,'lb and zones select'!$A$2:$A$73,0),
MATCH(H2,('lb and zones select'!$A$2:$K$2)) //Why the brackets?
),
IF( //False
AND(J2="Pounds",K2>5), //Condition
INDEX('lbs and zones priority'!$A$2:$K$73, //True
MATCH(D2,'lbs and zones priority'!$A$2:$A$73,0),
MATCH(H2,'lbs and zones priority'!$A$2:$K$2,0)
) //No false?
)
)
)
Looks like you have misplaced a bracket, and need to move it to the end.
(Skipping the False Statement statement will just mean that the formula returns FALSE in that situation)
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)
In one column in a spreadsheet, I have values: A,B,C,D,E,F,G,H,I,J,K :
A in rows 1-4,
B in rows 5-9,
C in rows 10-19,
D in rows 20-49,
E in rows 50-99,
F in rows 100-249,
G in rows 250-499,
H in rows 500-999,
I in rows 1,000-4,999,
J in rows 5,000-9,999,
K in rows 10,000+
I am using the following function:
=IF(OR(G2={""}), "", IF(OR(G2={"A"}), "1-4", ""), IF(OR(G2={"B"}), "5-9", ""), IF(OR(G2={"C"}), "10-19", ""), IF(OR(G2={"D"}), "20-49", ""), IF(OR(G2={"E"}), "50-99", ""), IF(OR(G2={"F"}), "100-249", ""), IF(OR(G2={"G"}), "250-499", ""), IF(OR(G2={"H"}), "500-999", ""), IF(OR(G2={"I"}), "1000-4999", ""), IF(OR(G2={"J"}), "5000-9999", ""), IF(OR(G2={"K"}), "10000", ""))
I am getting an error that states "You have entered too many arguments for this function".
Where am I failing?
When I run the following, I do not receive an error:
=IF(OR(G2={""}), "", IF(OR(G2={"A"}), "1-4", ""))
But the moment I add another line like the following:
=IF(OR(G2={""}), "", IF(OR(G2={"A"}), "1-4", ""), IF(OR(G2={"B"}), "5-9", ""))
I get the error.
How can I avoid this error?
The IF() syntax is
=if(condition, true result, false result)
You don't have that. You're doing
=if(condition, true result, false result, other result 1, other result 2, etc...)
which is a syntax error. If you want to chain IF()s like that, you'd need somethign like
=if(condition, true result, IF(othercondition, true result, IF(...)))
1 2 3 321
Note the bracket numbering.
No need for the OR in your example, and you need to get rid of the ,"" when you include another IF :
=IF(G2={""}, "", IF(G2={"A"}, "1-4", IF(G2={"B"}, "5-9", "")))
And the whole thing (you did the same error after the test for B) :
=IF(G2={""},"",IF(G2={"A"},"1-4",IF(G2={"B"},"5-9",IF(G2={"C"},"10-19",IF(G2={"D"},"20-49",IF(G2={"E"},"50-99",IF(G2={"F"},"100-249",IF(G2={"G"},"250-499", IF(G2={"H"},"500-999" ,IF(G2={"I"},"1000-4999" ,IF(G2={"J"},"5000-9999", IF(G2={"K"},"10000",""))))))))))))
You have too many arguments in your first IF statement. Try something like this
=IF(OR(G2={""}), "", IF(OR(G2={"A"}), "1-4", IF(OR(G2={"B"}), "5-9", "")))