I've tried searching, but maybe just haven't found the right combination of key words and have been unable to find a solution.
What i'm trying to do in Excel is generate a dynamic validation list based on a key value entered in another cell.
I have 3 worksheets: WSName(Columns)
Log (Buildings, Floors)
Buildings (BuildingId, BuildingName)
Floors (FloorId, BuildingId, FloorName)
I have created a named range for all my building ids called "BuildingIds"
I have created separate named ranges for all floors by building called "Floor#BuildingId#"
What I want is, when a Building is selected in the Log worksheet, the Floor list gets dynamically populated with the available floors for that building from the Floors worksheet.
My thought was in the Data Validation Source I should be able to do this:
=INDIRECT("Floors"&$A$2)
And it partially works, but always returns the same floors list because $A$2 isn't dynamic depending on the row it's in, so I need $A$2 to use the value from the current row.
This returns the value of the selected building that I want for the current row:
=INDIRECT("A"&ROW())
But when I try:
=INDIRECT(CONCATENATE("Floor","A"&ROW()))
OR
=CONCATENATE("Floor",INDIRECT("A"&ROW()))
I get an error.
Can you help me with this formula please?! Thanks in advance!
You use incorrect syntax - that's how manual link looks like:
='Sheet 1'!A1
Add exclamation and ' and you're done. The rest seems fine for me)
Ok, I've got this working, I simply set the Data Validation Source to:
=INDIRECT(CONCATENATE("Floors",A2))
Then when the formula was copied over the entire column, the A2 updated to the current row as expected.
#Peter L. Thanks for your help!
Related
I have some materials in column B, a few among these are in a Table definition called Material_List. In D49 I am trying to write a conditional statement such that, if the data in B49 already exists in the table definition, then print the header name or else INDIRECT($49). C49 has the independent dropdown list and D49 will be the dependent.
In D49 I have used the following formula within the Data-->Data Validation-->Source=
=IF(MAX((ISNUMBER(MATCH(Material_List;$B49;0))*COLUMN(Material_List)))=0;
INDIRECT($C49);
INDEX(Material_List[#Headers];1;MAX((ISNUMBER(MATCH(Material_List;$B49;0))*
COLUMN(Material_List))))))
with Allow=List. But it says Error "There is a problem with this formula"
When typed the following formula in cell D50 directly, it works well but obviously without dropdown.
=IF(MAX((ISNUMBER(MATCH(Material_List;$B50;0))*COLUMN(Material_List)))=0;
INDIRECT($C50);
INDEX(Material_List[#Headers];1;MAX((ISNUMBER(MATCH(Material_List;$B50;0))*
COLUMN(Material_List))))))
I am trying to build a dropdown list based on the mentioned criteria. could anyone please tell what is wrong with my formula?
I think the main issue with your formula is that you cannot use table references in the data validation.
Don't ask me why. I think it is just an outstanding Excel bug which hasn't been fixed yet. Please see this link for further info: https://exceloffthegrid.com/using-an-excel-table-within-a-data-validation-list/
The best way I have found to work around this is to create a named range which refers to the table references you need ("Material_List" and "Material_List[#Headers]" in your case). Then you can use those named ranges in your data validation instead of the table references directly.
However, I think there are also other issues with your formula. For example, this part:
MATCH(Material_List;$B50;0)
Normally a MATCH would be in the format of:
MATCH(<single value to look for>, <range to look in>, 0)
You appear to have that reversed, meaning that it should always return a #VALUE! error.
Also, I don't think you can use match on a 2D array, so if your "Material_List" table is more than a single column, that would also cause it to return a #VALUE! error.
UPDATE:
The way I would tackle dependent dropdowns would be as follows.
I would create a "Material_List" table similar to below (could be on a hidden sheet):
Then I would create 3 named ranges.
One for the table body range, called "MaterialList_TblRange":
=Material_List
One for the table header range, called "MaterialList_TblHeaderRange":
=Material_List[#Headers]
And one to refer to the dependant dropdown options, called "DropDownOptions" (this is by far the most complicated part):
=INDEX(MaterialList_TblRange,1,MATCH(Sheet1!$B23,MaterialList_TblHeaderRange,0)):INDEX(MaterialList_TblRange,COUNTA(INDEX(MaterialList_TblRange,1,MATCH(Sheet1!$B23,MaterialList_TblHeaderRange,0)):INDEX(MaterialList_TblRange,ROWS(MaterialList_TblRange),MATCH(Sheet1!$B23,MaterialList_TblHeaderRange,0))),MATCH(Sheet1!$B23,MaterialList_TblHeaderRange,0))
I will explain what this is doing in a moment.
The last step is to set up the data validation where we want our lists.
Where we want the master lists to appear, we can simply enter:
=MaterialList_TblHeaderRange
And the defendant dropdown validation can be entered as:
=DropDownOptions
This is the result:
Now back to the long "DropDownOptions" named range formula...
Basically, we use INDEX:INDEX to select the first/last cell in the range we want to use in out dropdown.
The first INDEX:
=INDEX(MaterialList_TblRange,1,MATCH(Sheet1!$B23,MaterialList_TblHeaderRange,0))
Simply selects the first cell from the column whose header matches the selection in our first dropdown.
The second index does the same, except that instead of selecting the first cell in the column, it counts the number of cells that contain text and uses that as the last cell in the range.
This does mean that we mustn't have any gaps in this table, otherwise an option might be missed off the end.
I hope this makes sense.
I am struggling with the autocomplete list in my excel document.
I was trying to use the example from OzGrid
https://www.ozgrid.com/Excel/autocomplete-validation.htm
But it seems like this step is not explained well enough.
First of all, I did step one by linking my cells between these 2 sheets.
[![enter image description here][1]][1]
In both "Frontsheet" and "Locality" the list range is from C51 to C67, as per the OzGrid advice.
Next the step with [Dynamic Ranges][2] probably refers to older versions of Excel with traditional menu, where we could select the "Tools" from the bar. Now in Excel 2016 I believe, that it should be like follows:
Formulas - Name manager - New... where we put our name, scope and refers to (range). I have created the Myrange
[![enter image description here][3]][3]
and finally, I put the formula (assuming that the C50 is my dropdown list cell):
=OFFSET(Frontsheet!$C$50,0,0,MATCH("*",Frontsheet!$C$51:$C$67,-1),1)
but I am getting nothing apart of #N/A
I don't know what's next.
I don't want to use VBA this time, because I want to have these lists allocated to the specified cells. I want to search the records by typing not by selecting since I have got them quite a lot. Is it possible?
This question is somewhat a duplicate to the previous ones, which unfortunately didn't bring me the solution.
Excel 2010: how to use autocomplete in validation list
Excel data validation with suggestions/autocomplete
Your formula =OFFSET(Frontsheet!$C$50,0,0,MATCH("*",Frontsheet!$C$51:$C$67,-1),1) shouldn't return anything but #N/A when entered in a cell because it defiens a range which Excel can't display in a single cell. However, you can use it to define a named range and then use that name to define a Data Validation list.
MATCH("*",Frontsheet!$C$51:$C$67,-1) doesn't work reliably if there are numbers in the lookup range. You might replace it with COUNTA(Frontsheet!$C$51:$C$67) which can deal with numbers or text equally well. The difference is that MATCH will produce the entire list, including intervening blanks, while COUNTA will truncate the list at the bottom by as many rows as there are blanks higher up. Either way, one usually avoids blanks in the source for a validation list.
If you want the user to be able to either choose or enter, you must disable Show alert after invalid data is entered on the Error Alert tab of the Data Validation dialog box, where you set up the validation rules.
The OzGrid solution is poorly written and deceptive. It is simply capitalizing on AutoComplete for cell values. There is no magic in linking to another sheet and using offset or in creating a named reference.
All you need to do is add a list of values you intend to use in the column above the column. Avoid empty rows between this list of 'default' values and what you intend to enter.
Skipped rows 'break' AutoComplete for cells.
But can be resolved by adding an adjacent contiguous 'indexing' column.
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 know the data validation only lets you place 255 characters. I have named cells/ranges as I have several list I'm trying to pull or select certain information from based on a criteria.
My formula is as follows:
=IF(AND(RETAILER="",DISPLAY_TYPE=""),"",IF(AND(RETAILER=CODES!$F$2,(OR(DISPLAY_TYPE=CODES!$V$1,DISPLAY_TYPE=CODES!$Y$1))),CODES!$V$2:$V$49,IF(AND(RETAILER=CODE S!$F$2,(OR(DISPLAY_TYPE=CODES!$AB$1,DISPLAY_TYPE=CODES!$AE$1))),CODES!$AB$2:$AB$94,IF(AND(RETAILER=CODES!$F$3,(OR(DISPLA Y_TYPE=CODES!C1,DISPLAY_TYPE=CODES!C2,DISPLAY_TYPE=CODES!C3,DISPLAY_TYPE=CODES!C4))),"INCORRECT COMBINATION, Correct Retailer or Display Type",IF(AND(RETAILER=CODES!$F$3,DISPLAY_TYPE=CODES!AH1),CODES!AH2:AH38,IF(AND(RETAILER=CODES!$F$3,DISPLAY_TYPE=CODES!AJ1),CO DES!AJ2:AJ10,IF(AND(RETAILER=CODES!$F$3,DISPLAY_TYPE=CODES!AL1),CODES!AL2:AL18,IF(AND(RETAILER=CODES!$F$3,DISPLAY_TYPE=C ODES!AN1),CODES!AN2:AN18,IF(AND(RETAILER=CODES!$F$3,DISPLAY_TYPE=CODES!AP1),CODES!AP2:AP18,IF(AND(RETAILER=CODES!$F$3,DI SPLAY_TYPE=CODES!AR1),CODES!AR2:AR29,IF(AND(RETAILER=CODES!$F$3,DISPLAY_TYPE=CODES!AT1),CODES!AT2:AT29,IF(AND(RETAILER=C ODES!$F$2,(OR(DISPLAY_TYPE=CODES!C5,DISPLAY_TYPE=CODES!C6,DISPLAY_TYPE=CODES!C7,DISPLAY_TYPE=CODES!C8,DISPLAY_TYPE=CODES !C9,DISPLAY_TYPE=CODES!C10,DISPLAY_TYPE=CODES!C11))),"INCORRECT COMBINATION, Change Retailer or Display Type",""))))))))))))
I know, too long for data validation, so, I then tried to "name" my formula by choosing a cell where my formula is nested (hit CTRL+F3, named the cell CHECK_FORMULA) and placed the above formula in the "refers to" box. Then, I went to C21 (where I want to have my data validation) and entered the following:
=IF(OR(RETAILER="",DISPLAY_TYPE=""),"INVALID",CHECK_FORMULA)
The error that I receive, " The list source must be a delimited list, or reference to a single row or column". The formula provides a set list of parts depending on the criteria set that will show. I didn't have this issue when the formula was under 255 characters, chose the list according to criteria, no problem, but now, because other list were added, I'm having this issue. Is there a macro I can put this into in order to accomplish my goal? or can I use CASE in a way to get what I'm trying to accomplish?
I think that data validation does not play nice with named ranges.
Try using the INDIRECT formula.
=IF(OR(INDIRECT("RETAILER")="",INDIRECT("DISPLAY_TYPE")=""),"INVALID",INDIRECT("CHECK_FORMULA"))
SOLVED....I placed the formula in a named range and it worked after I applied a "fix" to my Excel (issued by Microsoft): The name range 'CheckFormula' works with the following:
=`IF(AND(RETAILER="",DISPLAY_TYPE=""),"",IF(AND(RETAILER=CODES!$F$2,(OR(DISPLAY_TYPE=CODES!$V$1,DISPLAY_TYPE=CODES!$Y$1))),CODES!$V$2:$V$47,IF(AND(RETAILER=CODES!$F$2,(OR(DISPLAY_TYPE=CODES!$AB$1,DISPLAY_TYPE=CODES!$AE$1))),CODES!$AB$2:$AB$72,IF(AND(RETAILER=CODES!$F$3,(OR(DISPLAY_TYPE=CODES!C1048575,DISPLAY_TYPE=CODES!C1048576,DISPLAY_TYPE=CODES!C1,DISPLAY_TYPE=CODES!C2))),"INCORRECT COMBINATION, Correct Retailer or Display Type",IF(AND(RETAILER=CODES!$F$3,DISPLAY_TYPE=CODES!AH1048575),CODES!AH1048576:AH36,IF(AND(RETAILER=CODES!$F$3,DISPLAY_TYPE=CODES!AJ1048575),CODES!AJ1048576:AJ8,IF(AND(RETAILER=CODES!$F$3,DISPLAY_TYPE=CODES!AL1048575),CODES!AL1048576:AL16,IF(AND(RETAILER=CODES!$F$3,DISPLAY_TYPE=CODES!AN1048575),CODES!AN1048576:AN16,IF(AND(RETAILER=CODES!$F$3,DISPLAY_TYPE=CODES!AP1048575),CODES!AP1048576:AP16,IF(AND(RETAILER=CODES!$F$3,DISPLAY_TYPE=CODES!AR1048575),CODES!AR1048576:AR27,IF(AND(RETAILER=CODES!$F$3,DISPLAY_TYPE=CODES!AT1048575),CODES!AT1048576:AT27,IF(AND(RETAILER=CODES!$F$2,(OR(DISPLAY_TYPE=CODES!C3,DISPLAY_TYPE=CODES!C4,DISPLAY_TYPE=CODES!C5,DISPLAY_TYPE=CODES!C6,DISPLAY_TYPE=CODES!C7,DISPLAY_TYPE=CODES!C8,DISPLAY_TYPE=CODES!C9))),"INCORRECT COMBINATION, Change Retailer or Display Type",""))))))))))))`
Thank you to all those who provided assistance.
What I'm trying to do is make a drop down menu using a name range and data validation.
Simple enough however the problem arises when I have multiple cells running off the same name range.
In my spreadsheet I have two rows using two different name ranges. The problem is occuring for both. One line is employee names and one line is project manager names.
The following link is an image of the cells in question. I do not have 10 rep and as such cannot post an image sorry.
http://imgur.com/wfTaOZj
The first cell is normal and the drop down works fine however, the adjacent cell which is a copy of the first cell doesn't drop down anything.
the code I'm using to define the range for my drop down is:
=MANAGEMENT_list!$D$2:INDEX(MANAGEMENT_list!D:D,LOOKUP(2,1/(MANAGEMENT_list!D:D<>""),ROW(MANAGEMENT_list!D:D)))
The range goes from D2 to the last nonempty cell in column D.
When I do data validation for the other cells I get "the source Currently evaluates to an error".
Hopefully I've included enough information if not feel free to ask and I will clarify.
I think you have to lock your ranges since you are copying to the right:
From
=MANAGEMENT_list!$D$2:INDEX(MANAGEMENT_list!D:D,LOOKUP(2,1/(MANAGEMENT_list!D:D<>""),ROW(MANAGEMENT_list!D:D)))
To
=MANAGEMENT_list!$D$2:INDEX(MANAGEMENT_list!$D:$D,LOOKUP(2,1/(MANAGEMENT_list!$D:$D<>""),ROW(MANAGEMENT_list!$D:$D)))