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.
Related
I'm attempting to return a string of values that match multiple sets of criteria. All of the criteria except for the one that looks to see if the value matches a key seem to be working. I believe it has something to do with combining a array formula with a OR statement.
I was able to create one formula that worked using the TRANSPOSE function however, once I dragged it down my excel prompted me with the below error message. (Assuming it is too much data to compute)
Here is the formula that worked initially:
=TEXTJOIN(", ",TRUE,IF(('Sample Check Data'!$A:$A=Solution!B3)*('Sample Check Data'!$T:$T=Solution!D3)*('Sample Check Data'!$J:$J>Solution!G3)*('Sample Check Data'!$M:$M=TRANSPOSE(Criteria!$A$2:$A$8)),'Sample Check Data'!$H:$H,""))
Image
As an alternative, I built this formula which continues to fail to return a #VALUE Error (The bold highlight is what's causing it to fail. I, unfortunately, can't figure out the issue. Does anyone know how to resolve?:
=TEXTJOIN(", ",TRUE,IF(**'Sample Check Data'!$M:$M=OR(Criteria!$A$2:$A$8)***('Sample Check Data'!$A:$A=Solution!B3)*('Sample Check Data'!$T:$T=Solution!D3)*('Sample Check Data'!$J:$J>Solution!G3),'Sample Check Data'!$H:$H,"NoDataFound"))
I found the transpose solution on this thread but it did not mention any memory issue resulting from its use. TEXTJOIN based on multiple columns and multiple IF conditions
Any help or alternative solution would be greatly appreciated.
Update:
After some more trial and error I found a solution, however I'm still running into the Excel Ran Out of Resources Error.
=TEXTJOIN(", ",TRUE,IF(('Sample Check Data'!$A:$A=Solution!B3)*('Sample Check Data'!$T:$T=Solution!D3)*('Sample Check Data'!$J:$J>Solution!G3)* (('Sample Check Data'!$M:$M=Criteria!$A$2) +('Sample Check Data'!$M:$M=Criteria!$A$3)+('Sample Check Data'!$M:$M=Criteria!$A$4) +('Sample Check Data'!$M:$M=Criteria!$A$5)+('Sample Check Data'!$M:$M=Criteria!$A$6)+('Sample Check Data'!$M:$M=Criteria!$A$7)+('Sample Check Data'!$M:$M=Criteria!$A$8)),'Sample Check Data'!$H:$H,""))
I attempted to modify the column references from $A:$A to $A$1:$A$10000 that way less computing power is required. After making this change I now receive a N/A error. Are there any suggestions?
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"),"")
I have three lists of data. I need to check values from the first list against the second and third lists, and if the value appears I need to return that value. Here is the current formula I am using:
IF(MATCH(A2,$F$2:$F$2001,0) OR(MATCH(A2,K2:K2000,0)),"",A2)
but I receive an error.
Might someone please explain why and how to fix it?
Your OR operator is in the wrong place. From the look of your formula you don't wont anything to show if a match is found and if nothing is found A2 should be shown.
Here's something that should work:
=IF(AND(ISERROR(MATCH(A2, $F$2:$F$2001,0)),ISERROR(MATCH(A2,K2:K2000,0))),A2,"")
The reason for the ISERROR function is because if the value is not found, an error will be thrown.
Essentially, this forumla says if the value is not found in either column F or K, an error will be thrown and therefore the value is not present in either column. Otherwise the value is present in one of them.
Search both ranges. If no match in either, return "", otherwise return A2.
=IF(AND(ISNA(MATCH(A2,F:F,0)),ISNA(MATCH(A2,K:K,0))),"",A2)
I have a drop down list (data validation) that populates other cells using vlookup that pulls data from a separate worksheet. I'd like to include an error message if the field is blank like "No data entered". However, I am getting "0" instead. Here is the formula I used:
=IFERROR(VLOOKUP(ChildName,Children,6,FALSE),"No data entered")
I then changed this to an ISERROR:
=IF(ISERROR(VLOOKUP(ChildName,Children,5,FALSE))=FALSE,"No data entered", VLOOKUP(ChildName,Children,5,FALSE))
This gives the error message appropriately but now my drop down list does not populate the other cells!
What am I doing wrong? Thank you!
Looking at your formulas, I see two noteworthy points:
in the IFERROR you return the 6th column, in the ISERROR, the 5th!
in the ISERROR, you show the error message when something is found, as you say =IF(ISERROR=FALSE,ErrorMsg,...)!
To solve your problem, simply use this formula: =IF(ChildName="","No data entered",IFERROR(VLOOKUP(ChildName,Children,6,0),"Cannot find "&ChildName))
Ah, I see! Check out this question - Have Excel formulas that return 0, make the result blank. It shows all ways.
My favorite is =IFERROR(1/1/VLOOKUP(ChildName,Children,6,0),"No data!"). Only works with numbers though.
Else, use =IF(VLOOKUP(ChildName,Children,6,0),VLOOKUP(ChildName,Children,6,0),"No data!").
To be on the safe side, this version should take care of all potential issues: =IFERROR(IF(VLOOKUP(ChildName,Children,6,0),VLOOKUP(ChildName,Children,6,0),"No data!"),"No data!")
I have a column of data that will have more values added to it over time. I would like to use this column's values for List validation on another worksheet, such that the drop-down options reflect the current contents of the column. I tried creating a named range ListColumn with the following formula:
=ADDRESS(3,12,1,1,"DataSource")&":"&ADDRESS(COUNTA('DataSource'!$L:$L),12,1,1,"DataSource")
When I try to add validation for a cell, choosing Allow: 'List' and entering =ListColumn in the formula box, I get this error message:
The list source must be a delimited list, or a reference to a single row or column.
I tried wrapping the whole formula in an INDIRECT(), and while that didn't generate an error on the Name Manager screen, when I tried to add the validation, I got this error message:
The Source currently evaluates to an error. Do you want to continue?
I'm not sure what's wrong here. The second parameter of both ADDRESS() calls is the same, so the range address should refer to a single column. How can I set up the dynamic list validation that I'm looking for?
EDIT: Debugging this is producing some odd behavior. I keep getting a run-time error when I try to select ListColumn using Range("ListColumn").Select. Message is "Method 'Range' of object '_Global' failed."
Entering =ListColumn returns: 'DataSource'!$L$3:'DataSource'!$L$65, which is the expected value.
Also, when I enter the formula =COUNTA(ListColumn) it returns "1", but when I enter the formula =COUNTA('DataSource'!$L$3:'DataSource'!$L$65) it returns the correct value of "63". =COUNTA(INDIRECT(ListColumn)) also returns "1".
I believe the issue may be the inclusion DataSource as the text sheet name in the second ADDRESS block. I get the exact same behavior as you do when performing your steps above, but it seems to work with this:
=INDIRECT(ADDRESS(3,12,1,1,"DataSource")&":"&ADDRESS(COUNTA(DataSource!$L:$L),12,1,1))
You can then do exactly what you did above and use it in a drop-down. My best assumption would be that since you are already defining the sheet in the first portion of the address, you do not need to provide it in the second portion (and it will cause an error if you do). If you think about it from a program perspective, it makes sense (I think :) ), since it would be difficult/impossible to refer to ranges over multiple sheets, and therefore the syntax likely doesn't allow for a second sheet to be specified after the colon (even if it is the same). That is just conjecture though (probably wrong), so hopefully the solution works :)