I have written this to serve my purposes. The only part that doesn't work is the condition "if a cell is in a list and if the cell isn't empty AND isn't in the list, then return "New Index"". However for this condition it returns the #N/A error. Would anyone be able to see where my syntax is incorrect or perhaps my whole approach is incorrect!:
=IF(LEN(Data!E6)>0,IF(MATCH(Data!E6,'A L'!$K:$K,0)>0,"--","NEW INDEX"),"")
been baffled for a while so any help would be appreciated!
The MATCH() will return a number or an error so change it to:
ISNUMBER(MATCH(Data!E6,'A L'!$K:$K,0))
So your whole formula is:
=IF(LEN(Data!E6)>0,IF(ISNUMBER(MATCH(Data!E6,'A L'!$K:$K,0)),"--","NEW INDEX"),"")
Related
Good morning,
I would like to set a multiple if statement in Excel.
In row 8 you can see the following formula, which gives an answer in column Q. The answer based on this nested formula is Yes or No.
In row 13 all the cells are empty. Because the nested formula has been dragged down it still shows "No".
I was trying to write some double nested IF statement for this, which could cover the situation when the cells are empty and the Q column can come empty as well as a result.
=IF(OR(M9=" ",OR(N9=" ",OR(O9=" ",OR(P9=" "(IF(OR(M9="No", OR(N9="No", OR(O9="No",OR(P9="No")))))),"Yes","No")," ")
Unfortunately, the formula is not working.
Is it a possibility to add up an additional condition for the nested IF statement in Excel?
Something like:
=IF(COUNTA(M2:P2),<YourFormula>,"")
Where <YourFormula> is a placeholder for whatever formula you are interested in when any value in M2:P2 has a value.
As #JvdV has noted in comment above, your latest formula in comment above is still checking for a space, not a null (empty) cell.
Writing " " will look for a cell that contains a space (someone has hit spacebar). Writing "" will check to see if a cell contains nothing, in other words check to see it is empty.
I also noticed the error in your re-write: You wrapped the logical test within the parenthesis for the COUNTA formula. This is your formula corrected:
=IF(COUNTA(M9:P9)=0,(OR(M9="No",OR(N9="No",OR(O9="No",OR(P9="No"))))),"")
However, each OR statement gives a TRUE or FALSE result and can handle multiple arguments, as indicated by #SolarMike so I think you could probably re-write your formula to as follows to get the same result, if I have understood your requirements correctly:
=IF(COUNTA(M9:P9)=0,IF(COUNTIF(M9:P9,"No")>0,"Yes","No"),"")
I have a list DataValidation formula with depends on other column.
OFFSET(DATA!A2;0;MATCH(A1;DATA!1:1;0)-1;COUNTA(OFFSET(DATA!A:A;0;MATCH(A1;DATA!1:1;0)-1))-1)
When other column is empty the formula evaluates to an error (MATCH results in #N/A) and excel warns about it with:
"The source currently evaluates to an error. Do you want to continue?"
When I accept the warning popup DataValidation results in empty list, which is fine for me.
My goal is to create formula which will never evaluate to error but provide default value instead.
Is there a way to handle such error and provide empty list for excel? Or list with one item containing empty string?
My current idea is to create handling error with providing default empty list. But I cannot create proper syntax for it.
IFERROR(myformula, <empty list or list with one empty string>)
Any help would be appreciated.
NOTE: this question originates from my other problem where I created python script to reproduce this case.
Knowing MATCH results in #N/A I wrapped it in IF(IFNA(...
IF(IFNA(failingformula;FALSE);formula;someCellWithEmptyValue)
and whole formula is
IF(IFNA(MATCH(A1;DATA!1:1;0);FALSE);OFFSET(DATA!A2;0;MATCH(A1;DATA!1:1;0)-1;COUNTA(OFFSET(DATA!A:A;0;MATCH(A1;DATA!1:1;0)-1))-1);C3)
where fomula is written in question and C3 is some random cell I know will contain empty value.
Still if someone knows better and cleaner approach then please share the idea.
I'm not sure if this is a duplicate question, I've tried looking around but I don't see any duplicates. Pardon me if I'm wrong.
I've got a simple formula that I stacked many times to give me my end result, but I feel like it's too long.
I have 2 questions:
1) What can I do to shorten this super-long mess of a formula I've come up with; and
2) Is there a better way to do it?
I need someone to at least point me in the right direction to get started.
This is the formula: =IF((COUNTIF(B1:B10,"VC1"))=1,IF((COUNTIF(B1:B10,"VC2"))=1,IF((COUNTIF(B1:B10,"VC3"))=1,IF((COUNTIF(B1:B10,"VCG1"))=1,IF((COUNTIF(B1:B10,"VCG2"))=1,IF((COUNTIF(B1:B10,"X"))=1,IF((COUNTIF(B1:B10,"XM"))=1,IF((COUNTIF(B1:B10,"XG"))=1,IF((COUNTIF(B1:B10,"P"))=2,"10","P"),"XG"),"XM"),"X"),"VCG2"),"VCG1"),"VC3"),"VC2"),"VC1")
Basically, I have text in cells B1 to B10, each with unique values.
In case it's needed, the values are (not in order): X, XM, XG, VCG1, VC1, VC2, VC3, VCG2, P, P.
A different cell will have the formula that I mentioned, to ensure that each cell has a very specific text defined, or else it'll show an error message.
Because of this, I also have another question:
3) What can I do to make it such that I can search (or COUNTIF) all the values from B1 to B10, and make sure that there's an exact number of values with very specific texts inside, without it going in order of the formula?
To explain this further, the formula does an IF, then a COUNTIF. If the COUNTIF succeeds, it will move on to the next COUNTIF inside the value for the result. Because of this, I can't print multiple "errors" at once, and it goes for each "error" one by one, which can be confusing to the end user.
It might be something else than what you want, but what if you use something like this?
=(COUNT(B1:B10;"VC1")=1)*1&
(COUNT(B1:B10;"VC2")=1)*1&
(COUNT(B1:B10;"VC3")=1)*1&
(COUNT(B1:B10;"VCG1")=1)*1&
(COUNT(B1:B10;"VCG2")=1)*1&
(COUNT(B1:B10;"X")=1)*1&
(COUNT(B1:B10;"XM")=1)*1&
(COUNT(B1:B10;"XG")=1)*1&
(COUNT(B1:B10;"P")=2)*1
it would create a string of zeroes and ones (false and true) and from this you would be able to identify if something is wrong and even how many errors occured and why.
I was using this Index Match formula with no issues:
=INDEX('Rain Data For 9 Stations'!A:S,MATCH(RainWICSProximity!J100,'Rain Data For 9 Stations'!A:A,0),INDEX($N$4:$N$12,MATCH(H100,$M$4:$M$12,0)))
I added more data, and it now only returns some values, while returning #N/A for others, even though there is a value to return.
Index returns the value in a range.
What you are doing is =INDEX(MATCH(),INDEX(MATCH())). It works due to some luck, because sometimes the second Index() returns cell with value as well. However, if the second index returns cell with an empty value, then the first index has to return something like =Index(4,0), which is #N/A.
In general, try =Index(Match(),Match()).
To see where exactly the error is, select the cell with the formula, go to the Excel ribbon >Formulas>Evaluate Formula.
Then press a few times Evaluate Formula and see what happens:
See this answer for step-by-step formula evaluation.
#Vityata was correct, Index, Match, Match works wonderfully, also, my original formula does work.
The issue was, I had calculate set to Manual, not auto, in excel settings.
I believe you need to expand your range. I am not real familiar with Index Match but trying to learn to use it more, but I believe it is kind of like VLOOKUP. Your ranges $N$4:$N$12 and $M$4:$M$12 is where it is looking right? If so, those ranges are not expanding even though you added more data. So you need to expand it to like $M$4:$M$100 or whatever. Or expand it to find the last row which is what I usually do. like mine would be "$M$4:$M" & LastRow & "" or something like that.
Hi guys i would like to ask a very simple question,how to say "If the formula in this named range returns an error, then the value is one, else zero" in Excel?
I was thinking like "IF (A1:A200 Returns an Error, 1, 0).
I attach a screenshot so you guys could see what i am trying to do, the cells in red are the ones that contains error.
Thanks guys, your help would be very appreciated.
You can use SUMPRODUCT and ISERR (or ISERROR, see note below on the difference between these) functions. This will count the number of errors in the range:
=SUMPRODUCT(--ISERR(A1:A200))
Then, wrap it in an IF, like:
=IF(SUMPRODUCT(--ISERR(A1:A200))>0,1,0)
HERE is a good explanation of how the functions work.
NOTE: ISERR counts all errors except #N/A. If you want to also count #N/A, use the ISERROR function instead of ISERR.