excel data validation using single criteria in table - excel

This seems a straightforward requirement but I'm struggling to find an answer.
I have a simple table with a column listing product codes and another column listing whether it is active or not.
On a separate sheet, I want to use data validation to only list those products which are active.
I have found a number of examples which would require an initial selection of Yes/No for the status, which would then filter the list but I just want the list pre-filtered to show only the active products.
Is there a formula I can use in Data Validation which allows a preset criteria?
Thanks for any assistance.

After a bit more research I found the answer using OFFSET, MATCH and COUNTIF.
With a data validation type of List, the following formula only displays the rows where cell to the left (range named Active_Prod in this case) says Yes.
=OFFSET(Active_Prod,MATCH("Yes",Active_Prod,0)-1,1,COUNTIF(Active_Prod,"Yes"),1)
Hopefully this is of use to others.

Related

Using XLOOKUP when dynamically assigning rank to a table does not pull the correct data

The issue I am having is trying to use XLOOKUP on a table column that has been generated using a ranking formula.
The Rank column is created using the following formula so that it adjusts dynamically depending on the visible columns (auto-filtering) since RANK.AVG or EQ does not take that into account.
=SUMPRODUCT(SUBTOTAL(3,OFFSET(Table2[[#All],[Sales]],ROW(Table2[[#All],[Sales]])-MIN(ROW(Table2[[#All],[Sales]])),0,1)),--([#Sales]<Table2[[#All],[Sales]]))
The XLOOKUP I am using is simple
=XLOOKUP(1,Table2[Rank], Table2[Rep])
The idea is that the field at the top would show the top ranked performer based on the visible rows. The problem is that when filtering the data, the rank column adjusts as it should, but the XLOOKUP does not function as I would expect. It sticks with the originally ranked 1 or even does something complete weird that I can't explain when running combinations of filters in the region column..
Anyone have any advice how I could better structure this to make it function in the intended manner. Any help at all would be appreciated.
You'll need to employ a similar construction to account for visible rows only, for example:
=LOOKUP(1,QUOTIENT(0,SUBTOTAL(3,OFFSET(INDEX(Table2[Sales],1),ROW(Table2[Sales])-MIN(ROW(Table2[Sales])),))*(Table2[Rank]=1)),Table2[Rep])
Not sure why you're referencing the table header row in your other formula.

Making excel search using one letter in cell

So basically, I have been trying to make excel scan one column and print out the row for cells which have specific letters.
For example I have the following data in my sheet.
What is required is to be have excel search for the values which contain T and I, and then print the new rows. Kind of like separate the two into two different tables, because then so that I can do further analysis on them.
So far I have been trying to use the VLOOKUP() function, but the problem with VLOOKUP() is that excel required a proper match and not just a letter in the cell. I had tried with both FALSE and TRUE. Then instead I tried to use the =INDEX($B$4:$K$9;MATCH($A$17;$A$5:$A$9;0);COLUMN(A4)) to make it work. But that also does not work, since it also requires a full match. Also another problem which I didn't realise before is that how can excel recognise each cell, because I will have different number after the letters everytime and then so how can one make excel not repeat the same row twice?
I have used another approach where I copy the data in a separated sheet and then I simply filter out the Ts and then copy/paste the Is into another sheet and vice versa. it is time consuming and so it would be much better if I can simply copy/paste my new data and it would generate the division on its own.
any suggestions or link would be really helpful.
UPDATE
I had a new idea on how to approach this problem. I was thinking that is it somehow possible to have VBA code running for filtering the data. Is there a way to specify in VBA code to filter the data by "Starts With" and Make the results be printed in another cell block?
Looks simple enough. First step is to make sure you have headers over your data and that it is in proper table format similar to my picture. Then select Data set and press CTRL+T. That should turn you data in to table object with stripes. Use the Formula =LEFT(C2,1) to take out the first letter which will be L or T.
Select the table and press ALT+D+P which will generate a pivot table based off original data set.
Drag the column with the formula I suggested over to the FILTERS area of the pivot table ID column to ROWS and all others to VALUES. Simply refresh and as new data is added you will get new pivot tables. Do not put the pivot tables on top of each other as I did that is only for the picture so you can see it. If you have too many filters to apply you can right click the helper column in the pivot table fields area to produce a slicer which is a button that helps you change the report quickly. Any other questions do ask.

Excel Help: Dynamic range + Data Validation

I got a problem with some popular Excel question, dynamic ranges and data validation drop-downs and auto-populate. Lets say I got 2 sheets, and on one sheet I got drop-downs to choose from another sheet, and that is not a problem when I define cells and range using:
=OFFSET($A$19;;;COUNTA('0528 - info'!$E$2))
..but what about when I wanna add some new cells in between,so that they can be automatically recognized in which group they belong:
As you see for instance Column B has some "groups" where you can find more different "values" like in Column C, like Power Supply has MV1 and MV2... and so on. My drop-downs on the sheet 1 are called exactly like this "groups" and I did reference them manually using given function. But is it possible to populate my drop-downs automatically when I add for instance MV3 beneath MV2 in this table? Or RN7 on 14th row? Everytime I add new values I have to extend my dropdowns (what is fine..), but problem will be when I share this table to others, they gonna forget it 90%.
I hope you get my point, any suggest will be fine!
p.s. Indirect doesnt work in a way it should - It gives me all instances from the Column but not specific ones that I need.
=INDIRECT("Table4[VarEDS]")
Well this option gave me again what I already had before - all "matches" from the Column and still not ONLY matches that are for certain group. ...
If your Data Validation source is a "Table" as shown in your image then you can take advantage of "Table Column" Range which is dynamic. That means whenever you refer that column as NAMED range and if make changes to the column (Edit, Add, Delete) it will reflect in the referred cell.
You can use this technique even for ranges not in table. You need to NAME them with offset formula and make dynamic.
You can find dynamic address of your column as shown in the image below. Select entire column WITHOUT Header
Name your column data range with appropriate name as shown in image below
Then in Data Validation Window refer this name using F3 as shown in image below.
Then you can see... Even if you edit, add or delete any row in the column the data validation will change
Editing based on your comment below: If you want text from column B and Column C appear together in the validation dropdown list. Insert column in the table and join text from column B and C and then make data validation based on that column as shown in Colum D in image below
Finally I think I understood your question.
Watch this video
Excel: Find Multiple Matches & Dependent Drop Down List
After some days of searching and trying I got what I wanted - wasnt wasy job at all. Needed to combine more functions with the help of couple of videos from Leyla (Xelplus):
https://www.youtube.com/watch?v=gu4xJWAIal8
https://www.youtube.com/watch?v=7fYlWeMQ6L8&t=5s
First step was to make unique list of my values (text in my case) on separate sheet:
=IFERROR(INDEX(t_VarGroup[Vargrouptext];MATCH(0;INDEX(COUNTIF($J$2:J2;t_VarGroup[Vargrouptext]););0));"")
Then I needed to "extract" all the values that are belonging to the certain unique values:
=#IF($I3<COLUMNS($K$2:K$2);"";INDEX(t_EDS[[VarEDS]:[VarEDS]];AGGREGATE(15;3;(t_VarGroup[[Vargrouptext]:[Vargrouptext]]=$J3)/(t_VarGroup[[Vargrouptext]:[Vargrouptext]]=$J3)*(ROW(t_VarGroup[Vargrouptext])-ROW(t_VarGroup[[#Headers];[Vargrouptext]]));COLUMNS($K$2:K$2))))
FUrthermore, I created Unique drop down list:
=OFFSET($J$3;;;COUNTIF($J$3:$J$14;"?*"))
And then dependent drop down list nearby using:
=OFFSET($K$2;MATCH($H$2;$J$3:$J$17;0);;1;COUNTIF(OFFSET($K$2;MATCH($H$2;$J$3:$J$17;0);;1;20);"?*"))
And because I made it on other sheet, I had to reference them to an appropriate sheet name where my main sheet is - with drop downs, it is actually very useful for my future work and for everyone else who has struggling with drop downs but on a bit specific way =))
credits to: #Naresh Bhople for suggestion about Youtube videos.

Excel: How to lookup a value that has multiple search criterias?

I'm looking to implement a formula that would return the total quantity attributed to a certain ID. I was relying on a classic IfError and Vlookup combo to get the data, but I have many suppliers that use the same vendor code (supposedly unique ID) for different branches working on different commodities (which act as separate entities from a logistics perspective).
I have to manually split up the quantity attributed to certain suppliers by looking for the logistics agent responsible for them, and when the same log agent handles multiple commodities for the same supplier, I manually dig for the material codes.
I would like to know how to synthesize the manual process I undertake in a single formula.
I was using this formula to get the data in a pivot table =IFERROR(VLOOKUP(TRIM(A2),Pivot!$A$4:$B$105,2,0),0)
And I need to incorporate three search criteria to get the qty of a specific supplier's sub-entities (Vendor ID, name of Log Agent, Material ID).
[Part of pivot table where I'd get data pasted as value ][1]
[Example of how the data is stored and result I get with Vlookup function][2]
[1]: https://i.stack.imgur.com/A1v0f.png
[2]: https://i.stack.imgur.com/BmFi3.png
With the following solution, you will need to fill all the cells with vendor id and PURCH_GRP_NAME. If the range is built from a pivot table, there is an option to "repeat" the identical values on every row.
Once this is done, you can use a formula like this (the XXXXXX is the search criterion. I did not understand where this is supposed to come from):
=INDEX($D$1:$D$105,MATCH(XXXXXX,$A$1:$A$105&$B$1:$B$105&$C$1:$C$105,0))
Press Ctrl+Shift+Enter to turn it into a matrix formula.

Excel Dynamic Drop Down List

I have two tables that get dynamically created from a database query; the first table is the source of the drop-down list, and the second is the table that I will apply the drop-down list via data validation. First table:
and the second table:
What I need, ideally through just Excel formulas, is an intelligently designed drop-down that shows only the dimension values associated to the dimension in question.
So in cells B3:B10, the drop-downs would show a,b,c. In cells C3:C10, the drop-downs would show 1,2,3. In cells D3:D10, the drop-downs would show x,y,z. Etc, etc.
I need this to be dynamic in the sense that a week from now my DB query may return a fourth dimension that would need to follow the same approach.
Not sure if this is even possible without writing some VBA, but I figure I'd see if anybody has any creative ideas. Cheers!
You have to use Name Manager and =INDIRECT() formula to achieve that.
First download the sample file.
Sample File
See this tip (By me). It will help you to see screenshots step by step. Link is here
Now in-case of your data you have to use some formula to filter data automatically when new data come. So that new data can organize for dynamic combo boxes. I can also do that for you if you are not able to do that. Then share your sample workbook with me.
It is very possible, but not simple. There are a several ways to implement this, depending on your requirements, how dynamic it needs to be, and the expected structure of the data (as I mentioned in a comment).
I will give one possible solution, that is mostly dynamic, and is the simplest to explain. You can use a similar logic to make it all dynamic.
This solution will retrieve the data from table #1 according to the dimension name, assuming it is not sorted, and return the values in the order they are given in the table.
For some of the ranges I create names for simplicity, and some are mandatory. In order to follow the formulas logic you need the named ranges I use.
Create named ranges for table #1: (Either by using the Name Box or using the Name Manager Ctrl+F3):
For the data in the column Dimension: DimName =B3:B11
For the column Dimenstion Value: DimValue =C3:C11
Create dimension values lists in a new sheet:
Put the dimension name in B2 ="Customer". (The available dimension names can be created dynamically as well, but I'm skipping this part for simplisity).
B3 (array formula - Ctrl+Shift+Enter) =IFERROR(INDEX(DimVal,SMALL(IF(DimName=B$2,ROW(DimName)-ROW(INDEX(DimName,1))+1),ROWS(B$3:B3)),1),""). This formula returns the k-th value for the "Customer" dimension.
Copy B3 down to as many rows you think you'll need. Let's say B4:B10, so B3:B10 will have the array formula. The first cells will have the available values and the remaining cells will be empty because of the IFERROR function.
In B1 we will count the available values using the formula =SUMPRODUCT(--(B3:B10<>"").
Do the same for "Product" and "Geography" in columns C and D.
Create dynamic named ranges for the lists: (using the Name Manager Ctrl+F3)
For the lists' data DimLists =B3:D10.
For the lists' headers DimListHeaders =B2:D2.
For the lists' counts DimListCounts =B1:D1.
*These names are mandatory for the data validation to work in another sheet.
Set table #2 data validation list sources:
Select B3:B10 in table #2.
Go to Data > Data Validation, and select Allow: List.
Put the following formula in the source: =OFFSET(INDEX(DimLists,,MATCH(B$2,DimListHeaders,0)),,,INDEX(DimListCount,,MATCH(B$2,DimListHeaders,0))). This formula finds the correct list in DimLists according to the column header in table #2, and also sets the returned range height according to the list count.
Hope this helps.

Resources