Nested If shows #VALUE - excel

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.

Related

How to use IF function with 3 arguments while ignoring blanks

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.

Excel IF(OR) - two OR's formula works but three doesn't?

I can get a two possibility formula to work but not a three. I thought it would just be adding a comma for another term then adding a comma for a value. Please can anyone tell me why its not working?
Working one:
=IF(OR(C6="buy", C6="hold"),(F5*(D6+1)),(E5*(D6+1)))
Not Working:
=IF(OR(C6="buy", C6="hold", c6="sell"),(F5*(D6+1)),(E5*(D6+1)),0)
After reading your problem description couple of times over I think you need below formula:
=CHOOSE(MATCH(C6,{"buy","hold","sell"},0),(F5*(D6+1)),(E5*(D6+1)),0)
In your second formula you have two parts (E5*(D6+1)) and 0 for the Value is False section, this version will work: =IF(OR(C6="buy", C6="hold", C6="sell"),(F5*(D6+1)),(E5*(D6+1)))

Simple Excel IF statement not working.

I have no idea why this isn't working. It looks exactly like multiple sources I have found around the web. What am I missing?
Code:
=IF(A1="Select all",B1="Yep",B1="Nope")
This is the result:
You only need to put the result values in the 2nd and 3rd arguments:
=IF(A1="Select all","Yep","Nope")
It looked like you were trying to assign the values to B1 cell, but what actually happens is you get the result of doing a comparison to check whether B1 is equal to "Yep", which is causes a circular reference error because the formula tries to look at itself.
You don't need to say B1="Yep" Just put
=IF(A1="Select all", "Yep", "Nope")

Excel ISNUMBER Function with IF Statement

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")

If function returning FALSE from blank cells

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.

Resources