Simple Excel IF statement not working. - excel

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

Related

I got #num! error in my formula I used in Excel. I would like to ask where I got an error and What should I do?

I have an excel file that is populated with a lot of formulas. I am trying to populate the result by subtructing the latest value to the previous value and dividing the result given in the cell. Please see the photo below. As you can see, starting in row 6 i used the formula of:
"=ABS(IF(F7<=LARGE(IF(find3=$H7,$F$6:$F$196),10),(F7-LARGE(IF(find3=$H7,$F$6:$F$196),9))/E7,IF(F7<=LARGE(IF(find3=$H7,$F$6:$F$196),9),(F7-LARGE(IF(find3=$H7,$F$6:$F$196),8))/E7,IF(F7<=LARGE(IF(find3=$H7,$F$6:$F$196),8),(F7-LARGE(IF(find3=$H7,$F$6:$F$196),7))/E7,IF(F7<=LARGE(IF(find3=$H7,$F$6:$F$196),7),(F7-LARGE(IF(find3=$H7,$F$6:$F$196),6))/E7,IF(F7<=LARGE(IF(find3=$H7,$F$6:$F$196),6),(F7-LARGE(IF(find3=$H7,$F$6:$F$196),5))/E7,IF(F7<=LARGE(IF(find3=$H7,$F$6:$F$196),5),(F7-LARGE(IF(find3=$H7,$F$6:$F$196),4))/E7,IF(F7<=LARGE(IF(find3=$H7,$F$6:$F$196),4),(F7-LARGE(IF(find3=$H7,$F$6:$F$196),3))/E7,IF(F7<=LARGE(IF(find3=$H7,$F$6:$F$196),3),(F7-LARGE(IF(find3=$H7,$F$6:$F$196),2))/E7,IF(F7<=LARGE(IF(find3=$H7,$F$6:$F$196),2),(F7-LARGE(IF(find3=$H7,$F$6:$F$196),1))/E7,IF(F7<=LARGE(IF(find3=$H7,$F$6:$F$196),1),(F7-LARGE(IF(find3=$H7,$F$6:$F$196),1))/E7*(F7-LARGE(IF(find3=$H7,$F$6:$F$196),2))/E7)))))))))))"
In order to get the result of =(f7-f6)/e7. I added if functions cause there are some values that the lookup value is mentioned ($H7) below the table. When the lookup function was changed (please see the second photo), the formula was changed also into this:
"=ABS(IF(F15<=LARGE(IF(find3=$C15,$F$6:$F$196),10),(F15-LARGE(IF(find3=$C15,$F$6:$F$196),9))/E15,IF(F15<=LARGE(IF(find3=$C15,$F$6:$F$196),9),(F15-LARGE(IF(find3=$C15,$F$6:$F$196),8))/E15,IF(F15<=LARGE(IF(find3=$C15,$F$6:$F$196),8),(F15-LARGE(IF(find3=$C15,$F$6:$F$196),7))/E15,IF(F15<=LARGE(IF(find3=$C15,$F$6:$F$196),7),(F15-LARGE(IF(find3=$C15,$F$6:$F$196),6))/E15,IF(F15<=LARGE(IF(find3=$C15,$F$6:$F$196),6),(F15-LARGE(IF(find3=$C15,$F$6:$F$196),5))/E15,IF(F15<=LARGE(IF(find3=$C15,$F$6:$F$196),5),(F15-LARGE(IF(find3=$C15,$F$6:$F$196),4))/E15,IF(F15<=LARGE(IF(find3=$C15,$F$6:$F$196),4),(F15-LARGE(IF(find3=$C15,$F$6:$F$196),3))/E15,IF(F15<=LARGE(IF(find3=$C15,$F$6:$F$196),3),(F15-LARGE(IF(find3=$C15,$F$6:$F$196),2))/E15,IF(F15<=LARGE(IF(find3=$C15,$F$6:$F$196),2),(F15-LARGE(IF(find3=$C15,$F$6:$F$196),1))/E15,(F15-LARGE(IF(find3=$C15,$F$6:$F$196),2))/E15))))))))))"
But I've got a result of a #num! error. It's the same statement, the only difference is the looked up value. And when I try to show the calculation steps (Please see the third photo attached below), it says I've got an error in the first statement but why it was working on the first lookup value?
I am noob in excel. Please help me!!!
The reason for this error is that the LARGE function returns #NUM because the underlying array is empty / contains the FALSE result from your IF function (see here for details https://support.microsoft.com/en-us/office/large-function-3af0af19-1190-42bb-bb8b-01672ec00a64).
The reason here likely is that your find3=$C15,$F$6:$F$196 does not find a match.
Since we do not know what find3 is, you will need to look into the reason for that on your end (i.e., is there value of 5725 EGJ in your find3 data range? If not, why not? If yes, are you sure it spelled the same way (no leading spaces)?).
Once that is fixed you should be good to go.

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.

IF AND Statement

I have the following If statement which is working the way I want it too.
However I need to add an extra condition where IF C7 has no data in it then it will show as 0. At the moment the cell the formula is in is showing #VALUE.
I think that I will need to use IF(AND however my attempts have failed me.
=IF(C6="BT",12.88+(C7-30)*0.6,IF(C7<35,4.3,4.3+(C7-35)*0.2))
Thanks
You could check for blanks first.
=If(c7="",0,IF(C6="BT",12.88+(C7-30)*0.6,IF(C7<35,4.3,4.3+(C7-35)*0.2)))
I just thought to add another approach I often use because I think it makes it easy to read is;
=If(c7="",0,1)*IF(C6="BT",12.88+(C7-30)*0.6,IF(C7<35,4.3,4.3+(C7-35)*0.2))
And there's another to skin this cat...
=Iferror(IF(C6="BT",12.88+(C7-30)*0.6,IF(C7<35,4.3,4.3+(C7-35)*0.2)),0)

Nested If shows #VALUE

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.

Vlookup + Match issue

I have an issue with the formula below.
=VLOOKUP(B$22,Scenarios.New!$A$1:$M$211,MATCH(Output!$A27,Scenarios.New!$A$1:$M$1,0),FALSE)
Take a look at the image
This is basically doing one thing. Find the Action No. that is in the sheet "Scenario.New" of the Scenario ID 1017. It is working fine, as it returns 1,so formula is working, but sometimes I have 2 actions.
As you see. my formula will only look at the first Scend ID and will ignore the other one as is already found the first one. What I want to do is add a piece in the code that says Action No. = 1 or 2. Because based on the action No. some other fields will change too. Any ideas to solve it? Thanks!
first, i'm doubt with your question. second, your tabel is horisontal but you use VLOOKUP? or im wrong to undertand this?
but let me help you,i think you should try this,
table
enter image description here
=HLOOKUP(A5;Sheet1!$A$4:$G$5;2;FALSE)
take number 1 or 2 from table. but, if your table have double value be reference like image, HLOOKUP return first reference.

Resources