Cell Validation - From a List combining specific Cells; then all Cells from a Named Range - excel

In Short
Is there a function (like VSTACK) that I can stick into the Cell Validation Source: parameter that will produce a list for the user to select from that is based on a combination of a few single cells followed by all the cells from a Named Range? VSTACK would do the job, but fails as a source for Cell Validation.
Alternatively, if I point the Cell Validation Source: at another Cell and use the INDIRECT function to achieve the same result - what formula can I use in this second cell to produce a list for use in cell validation (in this VSTACK spills to produce a range of cells rather than a list in a single cell).
In Detail
I am building a sheet for Excel for Ipad and therefore VBA is a no-no.
I want to build custom lists of values for the purpose of cell validation. There are 500 or so cells in the sheet for user data entry and each cell could have a slightly different list, which changes based on user entry. Currently I have the validation for each cell pointing at a grid elsewhere in the sheet - in that grid is a 1:1 cell which contains the content to be used for validation.
Currently the validation is either:
a single number (time) : eg "01:20"
or a reference to a list of selectable times - such as "Block_5" which is a range with times from 00:00 through to 23:55, every 5 minutes.
This handled in the Cell Validation source with the following formula:
Data Validation / List / Source : =IF(ISNUMBER(CE16),CE16,INDIRECT(CE16))
In this way if the cell storing the validation list is just a number - that appears in the dropdown box. If it is not a number, the INDIRECT function kicks in and the user gets a list of all the times to choose from.
This works ok ... but ...
What I REALLY want is a combination. I want the list to have the time result ("01:20"") to then be followed by a space and then the list of all times for the user to select from if the one presented to the user is not correct, so - if I was to manually enter that into Cell Validation:
=01:20, ,00:00,00:05,00:10,00:15 ... 23:55
I just can't come up with a formula in Cell Validation (or alternatively a formula for the cell validation is point at to use the INDIRECT function) that produces a workable combined list.
Ideally - this would be a VSTACK function (where the first number is in cell CE21):
=VSTACK(CE21,"",Block_5). However this function fails as a source list for Cell Validation; and it produces a SPILL result as VSTACK won't give me a list in a single cell result that I can point Cell Validation at.
I know i could build an enormous array of a column of numbers for each and every one of the 500+ cells. Not doing that.
Any thoughts?
Thanks, Ken

Related

Having trouble with an Excel formula in the data validation window [duplicate]

Whenever I do a dependent dynamic drop down list , I see a bunch of blank cell in the drop-down list , I search many topics that explain how to remove them while by adding two additional ranges like explained her http://blog.contextures.com/archives/2014/02/27/dynamic-list-with-blank-cells/
but my question is: Is there anyway to avoid blank cell or remove them using a simple approach without the need of two additional ranges or a complex formula?
the drop down list that contains blank cell all I did is go to data validation and wrote in source =MYCode then I named the list that contains the codes like that MyCodeand I checked ignore blank case (even tho It seems to be useless )
There is another way. Create a dynamically-expanding named range. Then use the range to define the data validation list.
To create your dynamically-expanding range, insert this in the named range box and give it a name:
=OFFSET($A$1,0,0,COUNTA($A:$A),1)
$A$1 should be replaced with the top cell of your range. $A$A should be replaced with the column(s) the range is in.
OFFSET points the named range at a range of cells. COUNTA() is in the fourth position of the OFFSET formula, which sets the height of the range. It counts the number of non-blank cells. As a result, when you add a value, the fourth value of the OFFSET formula increases and you get an expanding range.
Note, this does not work if your named range has blank cells interspersed.
OFFSET formula from excel-easy.com.
After some more research I found a solution. In the cell where my information is filled I added a name using the name Manager and I added this formula that I adapted from this article:
=DropList!$J$1:INDEX(DropList!$J$1:$J$10000,SUMPRODUCT(--(DropList!$J$1:$J$10000<>"")))
It did what I needed without the need of adding 2 extra cell, even though the line of code is rather complex.
I know this thread is dead but I found a simpler solution which only requires you to create a single named range. It also works even if blank cells are interspersed in the source data, and expands as the source data expands.
First create your dynamically expanding named range using the formula given above:
=OFFSET($A$1,0,0,COUNTA($A:$A),1)
This will includes the values you want in your drop-down, as well as blank cells.
Next, in a separate cell, enter the following:
=FILTER(Your_Range, Your_Range <> "")
The result will be your source data with no blanks. This will spill into adjacent cells. Now can reference this single cell as your data validation list, as long as you add "#" to the end of the cell reference. This tells excel to include all the spilled values in the list.
Benefits:
If your source data named range is dynamic, the drop-down list will expand with this range, and you don't have to worry about updating a second named range.
You can easily filter more data, and it doesn't matter if blank cells are interspersed.
Combined with the SORT and UNIQUE functions, you can further improve how your data is represented in the drop-down list.
I couldn't find a solution this simple anywhere else, so I hope someone finds this useful.
If there are no empty cells within the source list, but the empty rows come from the end of the list, you can get rid of those by using a table as the source of the dropdown. You have to use the INDIRECT function to refer to the table:
Select the whole source list including the header
Click Format as table
Select the table, go to the Design tab (under Table Tools)
Rename the table
Select the cells where you want to use the dropdown and open the Data Validation
As the dropdown source, set: =INDIRECT("TableName[ColumnName]") (note the double-quotes)
This article explains the procedure in more detail

I am getting issue in making Excel data validation list(Drop Down) searchable like excel filter and select/deselect one or more values from the same

I am having a worksheet in excel in which I have created a data validation list in one column. The list have very large number of values so It is very tedious task to scroll through the list. I want to implement the functionality in which a search box will be there to faster retrieval of drop down value. also If there would be some check boxes to select all or deselect all after search results.
I am open for vba approach too please help me with the same .
Thanks in advance.
I have been thinking about (a purely formula-based solution to) this question since yesterday.
I found a solution that first allows you to create custom filters on lists, and then the data validation drop-down list is chosen from the filtered list.
(If necessary, you can just hide these filtered list helper columns, since there is probably no reason for the user to see them.)
See below, an example dataset that I created, and some example filters.
The Original List is in column A, then the C and E columns use formulas to filter the list to the left of it, based on the criteria (the yellow cells).
Here is the array formula I have in cell C2:
= IFERROR(INDEX($A$2:$A$8,SMALL(IF(LEFT($A$2:$A$8,LEN($B$2))=$B$2,
ROW($A$2:$A$8)-ROW($A$2)+1),ROW($A2)-ROW($A$2)+1)),"(no match)")
And here is the array formula I have in cell E2:
= IFERROR(INDEX($C$2:$C$8,SMALL(IF(LEN($C$2:$C$8)=IF($D$2=0,LEN($C$2:$C$8),$D$2),
ROW($C$2:$C$8)-ROW($C$2)+1),ROW($C2)-ROW($C$2)+1)),"(no match)")
I dragged these cells down to row 8.
Note these are array formulas, so you must press Ctrl+Shift+Enter on your keyboard instead of just pressing Enter after typing this formula.
Now the E column contains the original list, but with these two filters applied. Of course, you can add as many other extra filters as you desire. One disadvantage is that these formulas are fairly long and need to be created on an as-needed basis, but the formulas do generally follow the same structure if you compare the two formulas above.
Setting up the data validation drop-down list, I used this formula:
= OFFSET($E$2,0,0,IFERROR(MATCH("(no match)",$E$2:$E$8,0),ROW($E$8)-ROW($E$2)+2)-1,1)
This formula works by returning the list in column E, but it only returns the list up to (and not including) the first instance of where (no match) occurs.
See below, I have this in cell G2 in my example spreadsheet.
Side note: OFFSET is volatile and should typically be avoided, but unfortunately OFFSET is the only option (that I'm aware of) which allows you to use variable-length drop-down lists in data validation.
With this setup, you can change the fields in cell B2 and D2, which will ultimately filter the data in your original list and this filter will be reflected in your drop-down list.
See a few examples below of this working. Note the drop-down list changes depending on the outcome of the lists based on the filters.
No filters applied
Both filters applied
First filter only applied
Second filter only applied

Formula to count specific criteria in data set and another column

I am trying to get a count of specific value within a data set that match the name which is in another column. Basically I have a data set with different values along a time schedule.
I want to create a summary that counts the total number of each specific value per each unique individual.
Adjust your references to suit your data. The following formula is based on the picture below.
=COUNTIF(INDEX($B$7:$I$9,MATCH($A2,$A$7:$A$9,0),0),B$1)
With the proper reference locking, the above formula was placed in B2 and copied down and to the right as required.
Use the INDEX function to return to the entire row of data you are looking to count in. 0 will tell index that the entire row is returned.
Match is used to determine which of the rows to look in. The 0 tell match to look for an exact match.
now that you have the row of data you want to count in, use the COUNTIF function to count based on your matching criteria which is the header. By default COUNTIF uses and exact match = if no other comparison operation is given.
Alternative
You can use SUMPRODUCT. Depending on the size of your data and how often you repeat the formula, it may bog down your system as it will perform array like calculations. The following formula is based on the picture below and is placed in F3 and copied down and to the right:
=SUMPRODUCT(($A$8:$A$10=$A3)*($B$8:$I$10=F$2))
Alternative 2
The array formula of sumproduct which requires CONTROL+SHIFT+ENTER instead of just ENTER when finishing your formula and comes with all the same warnings as using SUMPRODUCT is:
=SUM(($A$8:$A$10=$A4)*($B$8:$I$10=J$2))
You will know you have entered is correctly as { } will show around your formula in the formula bar. Note these cannot be added manually. The ranges are based on the picture below.

Simple way to remove blank cells dynamic dropdown list Excel

Whenever I do a dependent dynamic drop down list , I see a bunch of blank cell in the drop-down list , I search many topics that explain how to remove them while by adding two additional ranges like explained her http://blog.contextures.com/archives/2014/02/27/dynamic-list-with-blank-cells/
but my question is: Is there anyway to avoid blank cell or remove them using a simple approach without the need of two additional ranges or a complex formula?
the drop down list that contains blank cell all I did is go to data validation and wrote in source =MYCode then I named the list that contains the codes like that MyCodeand I checked ignore blank case (even tho It seems to be useless )
There is another way. Create a dynamically-expanding named range. Then use the range to define the data validation list.
To create your dynamically-expanding range, insert this in the named range box and give it a name:
=OFFSET($A$1,0,0,COUNTA($A:$A),1)
$A$1 should be replaced with the top cell of your range. $A$A should be replaced with the column(s) the range is in.
OFFSET points the named range at a range of cells. COUNTA() is in the fourth position of the OFFSET formula, which sets the height of the range. It counts the number of non-blank cells. As a result, when you add a value, the fourth value of the OFFSET formula increases and you get an expanding range.
Note, this does not work if your named range has blank cells interspersed.
OFFSET formula from excel-easy.com.
After some more research I found a solution. In the cell where my information is filled I added a name using the name Manager and I added this formula that I adapted from this article:
=DropList!$J$1:INDEX(DropList!$J$1:$J$10000,SUMPRODUCT(--(DropList!$J$1:$J$10000<>"")))
It did what I needed without the need of adding 2 extra cell, even though the line of code is rather complex.
I know this thread is dead but I found a simpler solution which only requires you to create a single named range. It also works even if blank cells are interspersed in the source data, and expands as the source data expands.
First create your dynamically expanding named range using the formula given above:
=OFFSET($A$1,0,0,COUNTA($A:$A),1)
This will includes the values you want in your drop-down, as well as blank cells.
Next, in a separate cell, enter the following:
=FILTER(Your_Range, Your_Range <> "")
The result will be your source data with no blanks. This will spill into adjacent cells. Now can reference this single cell as your data validation list, as long as you add "#" to the end of the cell reference. This tells excel to include all the spilled values in the list.
Benefits:
If your source data named range is dynamic, the drop-down list will expand with this range, and you don't have to worry about updating a second named range.
You can easily filter more data, and it doesn't matter if blank cells are interspersed.
Combined with the SORT and UNIQUE functions, you can further improve how your data is represented in the drop-down list.
I couldn't find a solution this simple anywhere else, so I hope someone finds this useful.
If there are no empty cells within the source list, but the empty rows come from the end of the list, you can get rid of those by using a table as the source of the dropdown. You have to use the INDIRECT function to refer to the table:
Select the whole source list including the header
Click Format as table
Select the table, go to the Design tab (under Table Tools)
Rename the table
Select the cells where you want to use the dropdown and open the Data Validation
As the dropdown source, set: =INDIRECT("TableName[ColumnName]") (note the double-quotes)
This article explains the procedure in more detail

Excel Data Validation Source for different columns

I am making a series of cascading dropdowns in Excel. When a user selects an option in ColumnB, the sheet finds a list "Name"d = ColumnB value and set the validation for that column with that list.
It is working fine
But when I drag the cell in the whole column and try applying the Data Validation property to all cells, instead of selecting the previous cells respectively, it is defining every Data Validation property with the specific cell with which the first cell was binded.
It is not much of a problem as I can do that for individual cell, but I will be setting the data and names through code later, so I need to find a way that every Data Validation source contains a reference to its previous cell instead of that one specific cell.
Remove the $ sign. $ sign means that the reference is absolute and the cell reference in the formulas won't change when the cell is dragged or copied.
Another solution is to define the data validation for the entire column and you don't have to drag anymore.

Resources