Excel Drop Down + search function - excel

I have a drop down with a lot of list in it.
Its taking a long time just to search / scrolling down through the list.
is there any way to make it easier? For example: I can extend the scroll range longer (which is currently 8 items only), or maybe some sort of AutoComplete by typing the item name.
Its just basically to search the item easier in the drop down list.
Thanks!

You can use:
Cascading dropdown (such as xls cascading lookup based on pivot table style datasource? and http://www.contextures.com/xlDataVal02.html)
Use a formula in the Named Range for your List Validation that will simulate an autocomplete
Create a named range Test with this kind of formula :
=OFFSET($A$2,MATCH($C$1&"*",$A:$A,0)-2,0,COUNT($A:$A))
Where:
your list of data is in column A (values should be sorted alphabetically)
the current cell where you are applying the validation on is C1
Then you can:
start typing the text you want in cell A1, for instance Wash
then click on the drop-down list
the dropdown list will begin at Whashington and so on
I've just translated it from one of my old workbook so tell me if anything doesn't work.
[EDIT] Just a quick test seem to make it work (you should also restrain the end of the list for the beauty of the formula)

Related

Return array based on titles

I'm, looking for a way to return an array of text based off of titles or headers if you will. My brain isn't working today and I keep struggling to find the best method. I originally was going to have a bunch of IF statements and ran into problems, and I can't seem to figure out if Aggregate is a viable method.
Essentially if "Title 1" is selected from a drop down I would like to return the names within Title 1, and so on. If "All" is selected I would like all to populate from each title. The speed bumps I have is that some names repeat and I only want to show each name once always in alphabetical order. Can someone please get me started on how to tackle this?
In Excel O365 with the FILTER function, you can do this with a helper column (which you can hide, or position elsewhere).
I created a Table and am using structured references, but you can change to ordinary addressing if you prefer.
TitleList is a named range that includes all or your titles (presumeably you will use this for your dropdown).
For the Helper Column, I have it adjacent to your Names column with the formula:
=IF(OR(A2=TitleList),ROW(),B1)
This creates a unique number for each title.
Then, for your formula, under the dropdown, you can use:
=FILTER(Table3[Names],(Table3[Names]<>G1)* (Table3[Index]=XLOOKUP(G1,Table3[Names],Table3[Index])))
where G1 contains the dropdown
With Column B visible:
Some with O365 do not have the FILTER function. If you do not have the FILTER function, you can use:
=INDEX(Table3[Names],AGGREGATE(15,6,1/(INDEX(Table3[Index],MATCH(G1,Table3[Names],0))=Table3[Index])*ROW(Table3)-ROW(Table3[#Headers]),ROW(INDEX($A:$A,2):INDEX($A:$A,COUNTIF(Table3[Index],INDEX(Table3[Index],MATCH(G1,Table3[Names],0)))))))
EDIT
To return a non-duplicate list of ALL of the names, add ALL to TitleList and use this formula instead.
This formula makes a special case for ALL and filters out the rows that contain a Title
=IF(G1="ALL",UNIQUE(FILTER(Table3[Names],COUNTIF(TitleList,Table3[Names])=0)),FILTER(Table3[Names],(Table3[Names]<>G1)*(Table3[Index]=XLOOKUP(G1,Table3[Names],Table3[Index]))))
.imgur.com/apkHh.png

Excel data validation by typing instead of selection

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.

How can I remove an item from a cell's validation list when the cell already contains a value on that list?

I would like to remove an item from a cell's validation list when the cell already contains an item that has been selected from that validation list, in order to prevent the same item being re-selected in that cell.
Suppose an empty cell has the validation list {10,20,30,40,50}. When I select, say, '20' and then go back into that cell's validation list, I want to just see {10,30,40,50}. If I then select, say, '40' and go back into the validation list again, I want to see {10,20,30,50}, etc. It's important this also works for text values.
I originally viewed this problem as being about creating 2 lists and joining them together; e.g. in my first example, removing '20' can be thought of as creating lists {10} and {30,40,50}, so I tried using the 'comma' operator to join two ranges in the Data Validation dialogue, without success. I tried the same approach in a named formula and using that in the DV dialogue. Same result.
I created a UDF:
Function UNION(rRng1 As Range, rRng2 As Range) As Range
Dim rRng12 As Range
Set rRng12 = Union(rRng1, rRng2)
UNION = rRng12
End Function
and tried this in both the DV dialogue and via a named range. Still didn't work.
[EDIT]: This functionality needs to work in a structured table, where one of the columns is updated from the validation list.
I've concluded that I need to use an array formula within a named range, and reference this from the DV dialogue, but I'm not clear on how this can be done?
Here's what I came up with. It will work for numbers, but will probably need some work if your list is text.
In E1:E5, put your list (10,20,30,40,50). In G1:G5, put the formula
{=SMALL(IF($E$1:$E$5*($E$1:$E$5<>$A$1),$E$1:$E$5,""),ROW())}
That takes the list from E, removes the number in A1 that matches, and sorts it. Now create a named range called dvExclude with this as the RefersTo
=Sheet1!$G$1:INDEX(Sheet1!$G$1:$G$5,COUNT(Sheet1!$G$1:$G$5))
The G range will have errors at the bottom and this will exclude those - COUNT only counts numbers, not errors.
Finally, set up your data validation in A1 as List and =dvExclude.

Update dynamic drop-down list in excel without VBA

I want to create 2 dependent drop-down lists in excel, first drop-down value decides what value has to be displayed for the second dropdown.
Used following OFFSET formula for second dropdown values to get populated dynamically.
=OFFSET($B$2,MATCH($G$3,$B$3:$B$17,0),1,COUNTIF($B$3:$B$17,$G$3),1)
. I have also prepared a sample file showcasing the formulas I have used.
When I select first dropdown value, second dropdown list gets updated. BUT, when I select another value in first dropdown, second list doesn't showcase the values immediately.
Sample file link - https://drive.google.com/file/d/1rwt6B-INgrQ0NgxIl-Nc8JeoGziBaiL2/view?usp=sharing
Now that's what I call a challenging request.
We will use the secret Evaluate formula to achieve this.
Disclaimer:
Ensure that a status never get separated from its peers (e.g. do not add another New at the end of the table, rather insert a column so that statuses stay in packs).
Note that changing status will not clear the definition cell. Simple VBA will do the trick (and that is the only place where you will need VBA).
Solution:
Let's create a formula that returns a the address of the range we want to use in the dropdown. You can paste that it I3.
=ADDRESS(ROW(OFFSET($C$2,MATCH($G3,$B$3:$B$17,0),0)), COLUMN($C$2)) & ":" & ADDRESS(ROW(OFFSET($C$2,MATCH($G3,$B$3:$B$17,0)+COUNTIF($B$3:$B$17,$G3)-1,0)),COLUMN($C$2))
If I made no mistake with my French Excel, you should get the address of all the definitions for the status you put in G3. Extend the formula a few rows down and you will see it always matches G4, G5 and so on.
Time to define a Name (Menu Formula > Name manager > New), that we will call DynamicRange.
First, I would recommend to change the scope to your worksheet (Dropdown in the window).
Next, put the very formula we tried before, but in an EVALUATE.
=EVALUATE(ADDRESS(ROW(OFFSET($C$2,MATCH($G3,$B$3:$B$17,0),0)), COLUMN($C$2)) & ":" & ADDRESS(ROW(OFFSET($C$2,MATCH($G3,$B$3:$B$17,0)+COUNTIF($B$3:$B$17,$G3)-1,0)),COLUMN($C$2)))
Here what it looks like (except I'm all in French ...)
Go back to data validation and in the list's source, simply type =DynamicRange
The list is easy to define once the above was done successfully.
I see what you are trying to accomplish (get the second cell value to auto update to the first list entry), but I do not think it is possible without using VBA.
My understanding is that "Data Validation" only verifies the data within the cell, it does not change the existing value.
If you want to change the existing value, then I would look into VBA.

Using the Excel SMALL function with filtering criteria AND ignoring zeros

I have a list of prices for products that are variations (different size, color) of multiple parent product. Some products (for reasons not important to this question) have a price of zero.
I'm trying to write an excel formula that will return the lowest price for each parent product that is not zero
I've got this far:
=IF(SUMIFS(I:I,A:A,A3)=0,0,IF(AND(SUMIFS(I:I,A:A,A3)>0,MINIFS(I:I,A:A,A3)>0),MINIFS(I:I,A:A,A3),SMALL(IF(A:A=A3,I:I),2)))
Where I:I is the price column and A:A is the parent reference column
This works in all cases except where I have multiple variations of a parent product that have a zero value.
I need variables in a SMALL or MINIF function that will:
A. Only include the values for a single parent product in the calculation
B. Ignore any zeros in the calculation of the lowest value
Any help would be appreciated.
You can use a Pivot Table to easily create a dynamic list of minimums. Blank cells are ignored by default, and zero's (or any other number you want) can be excluded a few ways; I think the easiest would be using the Pivot Table's Filter feature.
They say a picture is worth a thousand words so an animated GIF must be worth a million... :)
More Information:
Office.com : Filter data in a PivotTable
Office.com : Display or hide zero values
tips.net : Excluding Zero Values from a PivotTable
You can use a 'traditional' PivotTable to do this. See ashleedawg's great answer.
You can also use a 'OLAP' PivotTable that's based off something called the Data Model to do it, that has a small advantage over the 'traditional' PivotTable in that you don't need to clear the PageFilter after refreshing. (More on this at the bottom of my answer).
Any Excel version from Excel 2013 later has the DataModel built in by default, and you also get access to the DataModel in 2010 if you install Microsoft's free PowerPivot add-in. Using the DataModel, here's what you need to do:
Turn your data into an Excel Table using the Ctrl + T keyboard shortcut:
Make a PivotTable out of it, but be sure to check the Add this data to the Data Model option:
Add Group to the Rows pane of the PivotTable, then right-click on Table1 in the fields pane and select Add Measure...:
Give the new Measure a name (I've called it Min Without Zero) and type =CALCULATE(MIN(Table1[Price]),Table1[Price]>0) in the Formula box then push OK:
Put a tick in the Min Without Zero checkbox in the PivotTable fields list.
Bing! The PivotTable shows the min (excluding zero) of each group by price.
Edit: I'd probably use ashleedawg's answer if I was doing this myself. But there's one caveat: If you add additional data in future and refresh, then you need to clear the filter and reapply the zero exclusion to be absolutely sure that any new numbers in the data are included. By way of a demonstration, if I filter out zero from a PageField, then I get just the result I expect:
...and here's how the filter looks:
But if I add new data and refresh, note that nothing has changed in the PivotTable:
...and if I look at the filter I can see why:
That's because when you deselect something from a filter, you're not actually saying "Give me everything except this thing" but rather "Give me the other things currently visible in this list, but leave any new things unselected."
Easily enough fixed: Just clear the filter and deselect zero again (or write some VBA code to do it automatically on refresh).
If the input data is sorted based on the parent reference level you can simply
use offset to find the required parent reference cells containing the price
Find the k-th smallest value using the SMALL formula (i.e. the smallest value)
Put a if condition to give you the 2nd smallest value if the smallest is 0
Place this in the 1st row
=IF(SMALL(OFFSET($I$1,MATCH(C1,$C:$C,0)-1,0,COUNTIF($C:$C,C1)),1)=0,SMALL(OFFSET($I$1,MATCH(C1,$C:$C,0)-1,0,COUNTIF($C:$C,C1)),2),SMALL(OFFSET($I$1,MATCH(C1,$C:$C,0)-1,0,COUNTIF($C:$C,C1)),1))
If you want a formula approach, you can use an IF statement to return a value if that value is over zero, and otherwise return FALSE, as functions like MIN conveniently ignore FALSE.
As per my other answer I recommend you turn the data into an Excel Table first with the Ctrl + T keyboard shortcut, as shown below. Then in a summary table you can use the following array-entered formula in E2:
=MIN(IF(Table1[Price]>0,IF(Table1[Group]=D2,Table1[Price])))
(Array-entered means you push Ctrl + SHIFT+ ENTER instead of pushing ENTER like you usually do)
And here's the result:

Resources