I have an Excel file I'm working with. There is a column that contains numbers and text, sometimes it's just one or the other. I'm trying to write a function that scans the left most part of the cell to see if it starts with a number. I thought I had it but apparently not. This is what I had:
=IF(ISNUMBER(LEFT(E8,1)), "True", "False")
This continues to throw me a "false" result even though that particular cell, E8, begins with a "3". What am I missing here?
Try this out:
=IF(ISNUMBER(VALUE(LEFT(E8,1))),"True","False")
Using the IF statement is redundant. The most simple and effective way to achieve your desired result is:
=ISNUMBER(--LEFT(E8,1))
It will automatically return TRUE or FALSE
Note that you can achieve what you require with just the following:
=NOT(ISERROR(LEFT(E8)*1))
If you do not LEFT(E8) evaluates to LEFT(E8,1) and multiplication by 1 throws an error on anything non-numeric
If you need your output as strings then update as per below:
IF(NOT(ISERROR(LEFT(E8)*1)),"True","False")
EDIT
Using ISNUMBER() is a good alternative to NOT(ISERROR())
=ISNUMBER(LEFT(A1)*1)
=IF(ISNUMBER(LEFT(A1)*1),"True","False")
=IFERROR(IF(VALUE(LEFT(E8,1)),"TRUE","FALSE"),"FALSE")
Related
=IF(AND(F2=N2;G2>O2);"No Notificar";"Notificar";IF(AND(F2=N3;G2>O3);"No Notificar";"Notificar";IF(AND(F2=N4;G2>O4);"No Notificar";"Notificar";IF(AND(F2=N5;G2>O5);"No Notificar";"Notificar";IF(AND(F2=N6;G2>O6);"No Notificar";"Notificar";IF(AND(F2=N7;G2>O7);"No Notificar";"Notificar")))))
As #KromeWing said - you've entered too many parameters for an IF formula.
It should have a logical calculation that would return TRUE/FALSE and then what to do if it's TRUE and what to do if it's FALSE.
Currently your formula reads as:
=IF(AND(F2=N2,G2>O2),"No Notificar","Notificar",
IF(AND(F2=N3,G2>O3),"No Notificar","Notificar",
IF(AND(F2=N4,G2>O4),"No Notificar","Notificar",
IF(AND(F2=N5,G2>O5),"No Notificar","Notificar",
IF(AND(F2=N6,G2>O6),"No Notificar","Notificar",
IF(AND(F2=N7,G2>O7),"No Notificar","Notificar")))))
It should look more like:
=IF(AND(F2=N2,G2>O2),"No Notificar",
IF(AND(F2=N3,G2>O3),"No Notificar",
IF(AND(F2=N4,G2>O4),"No Notificar",
IF(AND(F2=N5,G2>O5),"No Notificar",
IF(AND(F2=N6,G2>O6),"No Notificar",
IF(AND(F2=N7,G2>O7),"No Notificar","Notificar"))))))
So if the first equation is TRUE it will show No Notificar, otherwise it will test the second equation. If all equations return FALSE then it will return Notificar.
IF has only 3 parameters.
Your consecutive IF should be the 3rd parameter, there is no 4th parameter in this formula.
You are expecting IF() to accept four arguments instead of three.
I often get messed up by nested ifs, too, and it's usually from having to think too hard.
To make things easier on yourself, both today and next month when you come back to this and have to try to figure out what the heck you were trying to do, try using alt-enter to add a new line within your formula, allowing you to format your formula like this:
=IF(test, valueIfTest,
IF(test2, valueIfTest2,
IF(test3, valueIfTest3,
...
valueIfAllTestsFail
)))
I find that as long as I stick to this format, the hardest part of the syntax is reduced to having the right number of closing parentheses at the end, but thanks to how Excel color-codes matching parentheses, I can manage that even when I'm caffeine-deprived!
Okay so my question is how do i use IF with 3 arguments while one of the arguments is "Ignore blanks".
If A1 is "Escalation_complaint or "Escalation_request" B1 must show "Escalated".
If A1 is any other text, B1 must show "Solved"
If A1 is blank, B1 must remain empty.
Can someone please help me figure this out?
Your first test must be whether the A1 is empty or not. This must be the first because if you test whether an empty string is contained in another string the answer is always yes. =SEARCH("","Something") returns 1. So, How do you test for an empty cell? I recommend Excel's COUNTA() function but you may prefer testing for "". So, let's say, your first test is this.
=IF(COUNTA(A1), True, False)
Some would say IF(COUNTA(A1)>0, True, False) and that is equivalent. The simple IF(COUNTA(A1) tests for non-zero. Any number other than zero returns True.
So, now you got your basic function. What's supposed to happen if the result is True? What do you want to happen if the result is False? The latter is easy. If the result is False you want a null string returns. So, now your formula looks like this:-
=IF(COUNTA(A1), True, "")
Observe that we simply replaced the False with the desired output. So, what do you want to happen if A1 has something in it, if the first test resulted in True? There are two possibilities. That makes the problem solvable with a single IF. IF A1 has something starting with "Escalation" in it the result should be "escalate", else it should be "solved". So, how do you test for cell content?
=Find("escalation", A1) will not find "Escalation" (with a capital E). Therefore I recommend SEARCH(), which does.
=SEARCH("escalation", A1) should return 1. If it returns 1 your problem is solved because if it returns any other number its not "escalated" but "solved". Unfortunately, there is a third option. It might return an error. In fact it will return an error every time the word isn't found. That gives you a 3-way possibility (1, bigger than 1, or Error) which can't be solved with a single IF. So, I suggest to avoid the error.
=Find("escalation", A1 & "escalation") will find the word "escalation" every time. But it will find it in first position only if the conditions for "Escalate" is met. Therefore the formula for the True condition in the basic formula must be this:-
IF(SEARCH("escalation", A1 & "escalation") = 1, "Escalated", "Solved")
That's it. Assemble the second IF into the first and you're done.
So, using two if(), and minimising the testing you need :
=IF(left(A1,3)="Esc","Escalated",IF(A1="","","Solved"))
Edit: Based on a comment to another answer, if testing for "esc" only could lead to problems then how about:
=IF(left(A1,5)="Escal","Escalated",IF(A1="","","Solved"))
Which will avoid words like "escaped" or "escargot"...
If you know that the text will always be Escalation_complaint or Escalation_request, you can do this with a nested IF query. =IF in Excel takes three parameters: what to verify, result if true, and result if false. You can have another IF statement in the what to do if it returns false section. We can also do an OR() statement to verify both Escalation_complaint and Escalation_request. The result looks like this:
=IF(OR(A1="Escalation_complaint",A1="Escalation_request"),"Escalated",IF(A1="","","Solved"))
The order here is important because you want the "for all other cases" to be in the final IF statement.
If you have a situation where you could also have "Request_escalation" or "complaint_escalation", you should make a more general solution that uses SEARCH or FIND which would allow you to do a more general lookup that allows for more values without having to hardcode them. Here is an example that makes it possible to find the word Escalation anywhere in the cell:
=IF(IFERROR(SEARCH("escalation",A1,1),0)>0, "Escalated", IF(A1="","","Solved"))
Excel have maximum 30 arguments in a formula.
= if (A1=1, "True",if(B1>2,"True", "false"))
Understand this pattern. easy way.
If you no longer understand this, or if your problem has not been resolved, attach a file or screenshot that relates to your problem.
I have below formula. Its working for two first conditions.
=IF(F3="","",IF(F3="RUB",IF(FIND("2600",J3),MID(J3,FIND("2600",J3),14)),
IF(F3<>"RUB",IF(FIND(":59:",J3),MID(J3,FIND(":59:",J3)+5,14),
IF(F3<>"RUB",IF(FIND(":59F",J3),MID(J3,FIND(":59F",J3)+6,14)
))))))
but if if met below condition , it shows #VALUE!
IF(F3<>"RUB",IF(FIND(":59F",J3),MID(J3,FIND(":59F",J3)+6,14)
Is there any suggestions how to get it work?I tried to combine with OR and with IFERROR, but give no result.
There are still some 'holes' in your logic that were not covered by either your formula or narrative. These will return FALSE. However, this is closer to what you are trying to accomplish.
=IF(F3="", "", IF(F3="RUB", IF(ISNUMBER(FIND("2600", J3)), MID(J3, FIND("2600", J3), 14)),
IF(F3<>"RUB", IF(ISNUMBER(FIND(":59:", J3)), MID(J3, FIND(":59:", J3)+5, 14),
IF(ISNUMBER(FIND(":59F", J3)), MID(J3, FIND(":59F", J3)+6, 14))))))
I assume the problem with this:
IF(F3<>"RUB",IF(FIND(":59F",J3),MID(J3,FIND(":59F",J3)+6,14)
Is that the search text :59F cannot be found in the cell J3. If you change to this:
IF(F3<>"RUB",IF(ISNUMBER(FIND(":59F",J3)),MID(J3,FIND(":59F",J3)+6,14)
It should fix the problem.
EDIT shorter solution
IF(F3<>"RUB",IFERROR(MID(J3,FIND(":59F",J3)+6,14)
On a side note, your IF(F3<>"RUB",...) is superfluous because you already have a previous condition IF(F3="RUB",...), so it is a given that F3<>"RUB" if it didn't make it past the first condition.
Is there any reason in an Excel spreadsheet the expression OR(TRUE,#N/A) returns #N/A ?
How can we make it work the way we learned at school ie. OR(TRUE, whatever) should equal TRUE ?
so that we can evaluate a logical expression correctly even if not all parameters are known at the time of running, if those unknown are not really required.
Thank you
PS.
i use #N/A where the input is not known yet, it is not meant to be
an error. For instance
"=OR(turnover>1000000,leadtime>90,AND(turnover>500000,leadtime>30),AND(turnover>200000,leadtime>60))"
indicates an item needs special attention either because its
turnover is high or because its lead time is long but i don't
always have inputs for both. Sometimes one of two should suffice.
N/A is used when not known because i haven't found anything better than that. Tried "Unknown" string and AND(TRUE,"Unknown")
returns TRUE, which is not what it should be
i have many expressions which are more complicated than just
OR(x1,x2) so instead of trapping every parameter for error i have
written an udf OOR where OOR(TRUE,whatever even if error) = TRUE.
Just wondering if Microsoft has a better approach i don't know
You can wrap the logicals in an IFERROR that returns FALSE:
=IF(OR(IFERROR(A1=1,FALSE),IFERROR(B1=1,FALSE)),TRUE,FALSE)
You cannot compare to an error without throwing an error. Use ISERROR or ISNA on the cell to see if it contains an error.
=IF(OR(A1=TRUE,ISERROR(A1)), <something if true>, <something if false>)
In the above, you don't need to say A1 = TRUE, simply A1 will return true or false.
Ok, not sure if its the late night or tiredness but I can't find what's going wrong with this IF function.
=IF(B36="yes",F4+6,F4), IF(AND(B36="yes",C36="yes"),F4,F4+6)
It works fine except when both B36 and C36 cells are empty, when this happens I need it to display the info from Cell F4, but it just comes up FALSE.
Any ideas?
I tested your code and had a similar problem. I suggest you break it into parts and handle each part separately. Also, if I read it correctly, it looks like you have four comma separated items in an if statement that requires only three items. If statements require a logical statement, then a comma followed by the value if true, then a comma followed by the value if false. Check that out and see if it helps.
You missed to nest the second if function, hence your are not getting the expected result. Could you please explain more about what you exactly trying to do?
FYR => http://www.techonthenet.com/excel/formulas/if_nested.php
Use just:
=IF(AND(B36="yes",C36="yes"),F4,F4+6)
Why you need to use "=IF(B36="yes",F4+6,F4)," this part.