IF, OR and IFERROR function in excel - excel

Column_A Column_B New (Expecting result for this situation)
#N/A #N/A Manual Posting
My function has problem for the last syntax"IFERROR(IFERROR(....)" . Currently, I get #N/A for the "New" column. However, I want to get "Manual Posting" instead.
My syntax:
=IF(OR(IFERROR(B1,A1)="Bank BPH",IFERROR(B1,A1)="GE Budapest Bank"),"GECapital",IF(IFERROR(B1,A1)="Avio Aero","GE Aviation",IFERROR(IFERROR(B1,A1),"Manual Posting")))

Ok, working it out I think I can explain.
IFERROR(x,y) returns value x, unless it's an error, then it returns y .. (even if it is an error).
You then take result of that, and compare it to a string:
IFERROR(A1,B1)="Bank BPH"
Assuming valid values, that expression will, of course, return TRUE or FALSE.
If both A1 and B1 are error, however, what happens ??
What is the result of:
#ERR="string" ??
answer: an error ...
so what does the IF do with an error? it's neither true, nor false.
You can simplify the situation to just this expression to see what's going on:
=IFERROR(A1,B1)="Bank BPH"
it returns an error.
Neither true nor false.
You're going to need another check condition for an error and how to handle it ..
perhaps:
=IF(AND(ISERROR(A1),ISERROR(B1)), "Manual post", IFERROR(A1,B1)="Bank BPH")
might do the trick ??

I think I figure out the correct syntax. I used to put the "AND(ISERROR(B18),ISERROR(A18)),"Manual Posting" to the end. However, I moved it at the beginning, it seems the problem can be solved.
=IF(AND(ISERROR(B18),ISERROR(A18)),"Manual Posting",IF(OR(IFERROR(B18,A18)="Bank BPH",IFERROR(B18,A18)="GE Budapest Bank"),"GE Capital",IF(IFERROR(B18,A18)="Avio Aero","GE Aviation",IFERROR(B18,A18))))

Related

If(AND) combination produces "You've entered too many arguments for this function" error

hello everyone I'm here and needs help with excel
message from excel is
(you've entered too many arguments for this function)
and that my function.
=IF(AND(H2="A","B"),"group 1",IF(AND(N2H2="C","D"),"group 2",""))
please any one can help ?
The first condition to test within the IF statement "AND(H2="A","B")" will always return false - as this tests "Is H2 = "A" ? AND "Is '"B"'?
H2 cannot equal "A" and "B" simultaneously, and besides, even if you wanted to test that you'd have to use "AND(H2="A", H2="B").
Imagine someone asking you the Q "Is H2 = "A"?"
You could answer this if you knew what was in cell H2 (like Excel does) - and you could answer 'True' (yes) or 'False' (no).
But if you were asked is "B" as well? you would probably be quite puzzled - perhaps you would reply "Is "B" what as well"?
Excel would also be puzzled and in such circumstances the default response is 'False' (until proven otherwise!)
The 2nd AND statement is the wrong syntax - see here for some examples of how to use the AND statement.
This is probably why you are seeing the error you see - again:
If someone asked you "Is N2H2="C" and is "B" as well?
You wouldn't know which cell I was referring to (N2H2 does not exist in Excel)
Further, you wouldn't know what to say to "Is "B"?" (Is it a consonent? Is it capital? Is it the 2nd letter of the alphabet? Is it what?
Using this equation Excel will not return an error "too many arguments", it will return "invalid name error" (because there is no such thing as "N2H2" as far as Excel is concerned")
You need to use the following generic syntax for AND statements of this type:
AND(cell 1=some value1, cell 2= some value2) - not AND(cell1cell2=some value1, some value2)
i.e. this would be correct syntax:
=IF(AND(H2="A",N2="B"),"group 1",IF(AND(H2="D",N2="C"),"group 2",""))
(but it assumes you are trying to test cell N2 = B in the first AND statement because it's impossible for cell H2 to equal both A and B at the same time as I've said above)
As someone has pointed out in the comments - if you're testing whether H2 can be "A" OR "B" then simply use the OR statement - i.e. something like this:
=IF(OR(H2="A",H2="B"),"group 1",IF(AND(H2="D",N2="C"),"group 2",""))
https://support.microsoft.com/en-us/office/and-function-5f19b2e8-e1df-4408-897a-ce285a19e9d9

Why am I getting a value error in excel while using the ifs function?

=IFS(SEARCH("C*",A9),"Cake",SEARCH("K*",A9),"Cookies",SEARCH("B*",A9),"Bread & Bun",SEARCH("Y*",A9),"Pastry")
It works for the first criteria and returns "cake" but won't work for the others. I keep getting a #VALUE error.
Can help please??
SEARCH isn't a Boolean-valued function. It doesn't return FALSE if the string isn't found -- it returns a #VALUE! error which isn't coerced to FALSE.
What you could do is wrap everything like SEARCH("C*",A9) with ISNUMBER(): ISNUMBER(SEARCH("C*",A9)) since Excel can tell that #VALUE! isn't a number.

How can I nest an vector index match function in an if statement? (Excel)

I have the following vector function:
{=INDEX(Key!$K$2:$K$25,MATCH(TRUE,ISNUMBER(SEARCH(Key!$K$2:$K$25,V5)),0))}
This function returns what is in Key!$K$2:$K$25 if V5 is a match. This formula works. I would like to also make the function return, "Not Found", if the value searched for is not present in Key!$K$2:$K$25. I have tried the following, but it doesn't work. Could someone help?
{=IF(MATCH(TRUE,ISNUMBER(SEARCH(Key!$K$2:$K$25,V3)),0),INDEX(Key!$K$2:$K$25,MATCH(TRUE,ISNUMBER(SEARCH(Key!$K$2:$K$25,V3)),0)),"Not Found")}
Thanks.
simply merge your =INDEX(Key!$K$2:$K$25,MATCH(TRUE,ISNUMBER(SEARCH(Key!$K$2:$K$25,V5)),0)) with IFERROR
=IFERROR(INDEX(Key!$K$2:$K$25,MATCH(TRUE,ISNUMBER(SEARCH(Key!$K$2:$K$25,V5)),0)),"Not found")

If OR with RIGHT in Excel

This seems simple, but evidently incorrect. Have any ideas?
The data:
Cell J5 value is simply this URL:
www.url.com/at/
The logic: Check if cell J5 ends in "/at/" or if it ends in "de/", value if true for either one of those is 1, value if false for both is zero.
Here's the function I'm trying out:
=IF(OR(RIGHT(J5,4)=“/at/"),(RIGHT(J5,3)=“de/"),"1","0")
My result is #NAME?
The double bracket characters are incorrect (before the /at and before the de/). Make sure you use "" around string literals. Secondly the closing bracket is not required after the first RIGHT and does not need open bracket before the second right. With these corrections the formula becomes:
=IF(OR(RIGHT(J5,4)="/at/",RIGHT(J5,3)="de/"),"1","0")
Your command has incorrect parenthesis.
Your command:
IF(OR(RIGHT(J5,4)=“/at/"),(RIGHT(J5,3)=“de/"),"1","0")
OR(RIGHT(J5,4)="/at/") is the cause of output #NAME because OR in this case has only one operand.
You should not close the parenthesis here and should close it after the second operand.
Try:
IF(OR(RIGHT(J5,4)=“/at/",RIGHT(J5,3)=“de/"),"1","0")

Nested IF statement returning false

I have a nested if statement is returning "False" rather than the expected outcome.
Scenario
Table "High VoltageCables" has data in it that default to numeric but may contain characters: kVa
Table "Master" checks "High VoltageCables" data as blank or not blank, and returns "Failed Check 1","Passed Check 1". This works fine.
Table "Meta" then checks the results of "Master" and then tests "High VoltageCables" data for length between 1 and 6, regardless of whether record is numeric or string.
Formula
=IF(MASTER!H2="Passed Check 1",IF(LEN('High VoltageCables'!O2)>=1,IF(LEN('High VoltageCables'!O2<6),"Passed Check 2","Failed Check 2")))
This is partially succesful, as it returns "Passed Check 2" for the following sample data in the source table "High VoltageCables".
1 numeric, or
1kVa str, or
50000 numeric
However if a field in "High VoltageCables"is blank, the formula returns "FALSE" rather than "Failed Check 1"
I inherited this task, (and would have preferred to do the whole thing in Access using relatively simple queries) - and unfortunately I am new to nested If statements, so I am probably missing something basic...
NB the data in High VoltageCables must default to numeric for a further check to work.
The first and second IF's seem to be missing the else part. They should be added at the end between the ))) like ), else ), else )
Every IF statement consists of IF( condition, truepart, falsepart) if you have two nested ifs it will be something like IF( condition, IF( condition2, truepart2, falsepart2), falsepart)
Hope that makes it a little clearer
You do have an unaccounted for FALSE in the middle IF. Try bring the latter two conditions together.
=IF(Master!H2="Passed Check 1",IF(OR(LEN('High VoltageCables'!O2)={1,2,3,4,5}),"Passed Check 2","Failed Check 2"))
It's still a bit unclear on what to show or not show if Master!H2 does not equal "Passed Check 1".
I failed to construct the formula with a concluding "else" - "Failed Check 1"
Using jeeped's and Tom's suggestion and adding the final "else" part I have solved the problem:
=IF(MASTER!H2="Passed Check 1",IF(OR(LEN('High VoltageCables'!O2)={1,2,3,4,5}),"Passed Check 2","Failed Check 2"),"Failed Check 1")

Resources