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!")
Related
I don't have any experience with creating excel data validation formulas.
I have 2 code formulas, which are generated in java code, which are coming from excel data validations:
COUNTA('User Input Sheet'!A:A)-4
IF(COUNTA(INDIRECT(ADDRESS(ROW(A5),COLUMN(A5),1,1,"User Input Sheet") & ":" & ADDRESS(ROW(AJ5),COLUMN(AJ5))))=0, "","POP")
Can someone help me how to write the data validation formula for the above two, as I have to use for different cells, but don't know how to put in cell data validation ?
Providing more information on what it is you're actually trying to do, will help you, as well as helping anyone who's trying to help you. e.g.:
Your 1st formula returns the number of non-empty cells in column A of a sheet, less 4.
But you don't say if the cell being validated needs to be more, less, the same or not the same as that. If you know the answer to that, the formula as is (with = in front) will work directly in the Data Validation 'value range' fields. e.g.:
The above example validates that a cell value is between zero and the results of the formula.
Suggest adapting and applying that, and if you're not getting the expect result, explain what you were aiming for, what you did, and what the results are.
=====================================================
The second formula is more problematic in terms of trying to guess what it is you're trying to do.
One thing I'll point out first thought: it uses INDIRECT in a completely unnecessary way (and that's inherently unwise). So the first thing to do is covert to a direct reference per:
=IF(COUNTA('User Input Sheet'!A5:J5)=0, "","POP")
But even then, you have a formula that returns a zero-length string ("") or literal 'POP' (based on A5:J5 being empty or not).
And it's unclear how you intend to use that to validate a cell. One guess would be the user has to enter "POP" or nothing (depending on A5:J5 being populated or not). But that seems to be an odd thing to do.
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 sheet which has cells with the text "Test Result" and the cell next to "Test Result" contains either Pass or Fail. I want to count the number of Pass and Fail instances which are mentioned next to the cell containing "Test Result".
NOTE: The column which contains the Pass or Fail that I want to count, has other Pass/Fail instances as well. So, I want to get the Pass or Fail value which is ONLY next to the a cell containing text "Test Result".
You can use the COUNTIFS function to accomplish this. If your data was in columns A and B, this is how you would enter the formula:
=COUNTIFS(A:A,"Test Result",B:B,"Pass")
If your data is predictably structured, and you are only trying to return a single result- I would go with #Scott Craner's answer of using VLookup or Index/Match.
If your data is predictably structured, and you want to count across many results, you should probably be considering using 2 sumifs functions (one for pass and one for fail).
If your data is not predictably structured, you can consider using an array of these sumifs functions to each check a particular column against its offset column, or you can accomplish this using VBA, but it's hard for me to suggest the exact code without seeing how the data is structured/unstructured. (Your explanation of the sheet and data layout is a bit vague)
I've been struggling with this longer than I care to admit, but I have a fairly simple OFFSET function call which works on one sheet, but if I copy it to a different sheet it gives a #VALUE error.
On a sheet named "Deliverable" I have this formula in a cell:
=OFFSET(Deliverable!$B$72,1,0,,3)
and it works fine.
If I go to any other sheet and use the same exact formula, or use it in the Name Manager, it gives a #VALUE error.
If I leave off the final parameter indicated the number of columns I want, it does work:
=OFFSET(Deliverable!$B$72,1,0)
but of course isn't giving me the range I need.
Any idea what's going on with this?
I'm using Excel 2016 on Windows 7.
-- Updated Info --
In a nutshell, my spreadsheet has two cells which I'm using as dropdown lists, where the 2nd cell's list feeds off the selection in the first. The data they are based on has this format:
OptionA A B C D
OptionB A B
OptionC D E F
So the first dropdown uses a simple Data Validation source pointing to the column with OptionA, OptionB, etc. Once that's chosen, the second dropdown list should contain the appropriate options for the one selected. So if OptionB is selected, then the 2nd dropdown list should show A and B.
When I initially wrote this, the data validation source was just a simple VLOOKUP entry, but the lists often had blanks since the number of options varies for each entry. Wanting to fix it up a bit, I ended up with this formula:
=OFFSET(Deliverable!B72,Deliverable!B87,0,1,COUNTA(OFFSET(Deliverable!B72,Deliverable!B87,0,1,5)))
There won't be any more than 5 options, and there are no empty cells in the middle of the data to filter out.
In one spreadsheet I have I used this as a named range definition, then specified the named range for the cells data validation source and it worked. In this other spreadsheet however, it gave me the error described earlier.
However, it looks like when I enter the statement directly into the data validation source field and not in the name manager, it works as expected.
Am I taking the totally wrong approach?
What is it that you want this formula to do? As written, it is returning a block of three horizontal cells. The #VALUE error is Excel's way of telling you "Hey, you're trying to return three cells, but I can't fit them all in the one cell that you are calling this formula from".
The reason you see a result in some places and not others is because of something called Implicit Intersection. Give it a spin on Google. But basically, it just returns whichever one of those three results corresponds to the column that the formula is entered into. If you copy that exact same formula to say row F you will see that it returns a #VALUE error there, because it doesn't know what cell it should return given the column you're calling it from doesn't match any of the cells it is returning. The fact that you don't know this indicates that the formula you're using doesn't in fact do what you think it does.
--UPDATE --
Okay, following your further clarificaiton it seems that you're talking about Cascading Dropdowns aka Dynamic Dropdowns. Lots of info on Google about how to set these up, but you may be interested in an approach I blogged about sometime back that not only provides this functionality, but also ensures that someone can't later on go and change the 'upstream' dropdown without first clearing the 'downstream' one should they want to make a change.
Note that those links talk about a slightly complicated method compared to others, but the method has it's advantages in that it also handles more levels than two, and your DV lists are easily maintained as they live in an Excel Table.
This sounds like an array equation. Try hitting Ctrl+Shift+Enter in the other sheets to validate it as an array equation.
Whenever you need to reference ranges instead of single cells, Excel needs to know that you are working with arrays.
I'm trying to get a cell to pick a cell of data from a table using IF (Excel 2010, can't do IFS), but when I try to nest more than 2 IF, it returns a "too many arguments" error. Formula at this point:
=IF(B11="Humain",VLOOKUP(COO,Fonctions!A88:M110,2,FALSE),IF(OR(B11="Hybride Naturel",B11="Géno-Hybride"),VLOOKUP(COO,Fonctions!A88:M110,3,FALSE)))
Where am I doing it wrong? :/
You're missing a final comma should the second IF condition return false. Update your formula like so:
=IF(B11="Humain",VLOOKUP(COO,Fonctions!A88:M110,2,FALSE),IF(OR(B11="Hybride Naturel",B11="Géno-Hybride"),VLOOKUP(COO,Fonctions!A88:M110,3,FALSE),"N/A"))
Notice the N/A that will be produced should both IF statements do not yield any results.