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", "")))
Related
I got this formula in inputted which pulls out the value =IF(LEN(LEFT($A2, SEARCH(".xyz", $A2)-1))<13, "Invalid", "")
However I want to include this part of the formula =IF(LEN(LEFT($A2, SEARCH(".twy", $A2)-1))<13, "Invalid", "")
I tried adding OR after the first IF and combining both but it does not work. Any suggestion?
Below is the sample
ID
Result
asldna.xyz
asd.twy
Invalid
asdjhhh.cyv
Invalid
asdhthen.xyz
asdh.xyz,asdh.cyv
Invalid
Try this:
=IF(LEN(LEFT($A2, SEARCH(".xyz", $A2)-1))<13, "Invalid", IF(LEN(LEFT($A2, SEARCH(".twy", $A2)-1))<13, "Invalid", ""))
Such that if the first if is not true and then the second if is not true the output is "".
Edit based on comment:
=IF(LEN(LEFT($A2, SEARCH(".xyz", $A2)-1))<13, "Invalid_1", IF(LEN(LEFT($A2, SEARCH(".twy", $A2)-1))<13, "Invalid_2", ""))
My dataset looks like this:
I am looking for a formula to add to the column "Status" to do the following:
If Name = "A" and Project = "TT" and Number > 5, write "PASS" otherwise write "FAIL"
If Name = "A" and Project = "NN" and Number > 10, write "PASS" otherwise write "FAIL"
If Name = "B" and Project = "TT" and Number > 20, write "PASS" otherwise write "FAIL"
I struggle puting together something that works with "IF" and "OR".
Would anyone be able to offer a simple solution?
Breaking this into parts:
AND(A2="A",B2="TT",C2>5)
AND(A2="A",B2="NN",C2>10)
AND(A2="B",B2="TT",C2>20)
Then using OR:
=IF(OR(AND(A2="A",B2="TT",C2>5),AND(A2="A",B2="NN",C2>10),AND(A2="B",B2="TT",C2>20)),"PASS","FAIL")
I want to remove text after second whitespace in a cell
this is for excel
Eduardo Nunez (R) 2B vs. BAL
Eduardo Nunez
I expect just first name and last name
So, if there is always an item in brackets then this works:
=TRIM(LEFT(A1,FIND("(",A1,1)-1))
See
Note I tested for multiple spaces at the beginning...
If the value you've provided is in cell A1 ...
=LEFT(TRIM(A1),FIND(" ",TRIM(A1),FIND(" ",TRIM(A1))+1)-1)
Try,
=REPLACE(A2&" ", FIND("|", SUBSTITUTE(A2&" ", " ", "|", 2)), LEN(A2), "")
If the ( is always in that place then this shorter version,
=REPLACE(A2, FIND("(", A2)-1, LEN(A2), "")
Sounds like you might have some space/break issues. Try the below. Contains two helper columns. Should quickly calculate and do what you're looking for, but please let me know if it doesn't.
B2 (Helper 1): =TRIM(SUBSTITUTE(A2,CHAR(160)," "))
C2 (Helper 2): =MID(B2,SEARCH(" ",B2)+1,LEN(B2))
D2 (Result): =LEFT(B2,SEARCH(" ",B2)-1)&" "&LEFT(C2,SEARCH(" ",C2)-1)
So, I'm using Excel as a query builder (lots of us have been there), but I have a problem. Some of the columns, which have empty data, have to be inserted as NULL, so the cleanest way to do this that occurred to me was to use the SUBSTITUTE formula to find those empty spots and change them for NULLs.
This is what I have, as an example:
INSERT INTO blah (meh1, meh2, meh3, meh4, meh5, meh6) VALUES (14, '', '', '', '', 5)
And this is the formula I use:
=SUBSTITUTE(*cell*;", ,";", NULL,")
This, in my head, should change all the appearances of ", ," to ", NULL,", resulting in something like this:
INSERT INTO blah (meh1, meh2, meh3, meh4, meh5, meh6) VALUES (14, NULL, NULL, NULL, NULL, 5)
But in the end, what I get is...
INSERT INTO blah (meh1, meh2, meh3, meh4, meh5, meh6) VALUES (14, NULL, '', NULL, '', 5)
Does any of you know why this happens and how to solve it?
I have made a workaround by using 2 SUBSTITUTEs, but it feels sloppy.
If you want to test this yourselves with something cleaner, try this:
Original cell content:
a, a, a, a, a, a, a
Substitute function:
=SUBSTITUTE(*cell*;", a,";", B,")
And this is what you will get:
a, B, a, B, a, B, a
Just in case, I got this solved by omitting the first comma in the search pattern.
This is, instead of looking for ", ," I searched for " ," and it worked fine.
In this case, there was no other way that a " ," would appear in the text, so I'm going with that.
=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.