Data Validation List without duplicates

dsubash

New Member
Joined
Nov 22, 2024
Messages
39
Office Version
  1. 2019
  2. Prefer Not To Say
Platform
  1. Windows
Dear experts,

I have a database in Sheet 1, which contains the following fields
Col. A - List of Branches (Contains Duplicate Entries)
Col. B - List of Products (Contains Duplicate Entries) - certain products are unique to only certain branches while few products are available in all branches.
Col. C - Col. M - other details.

This sheet contains more than 10000 records containing the transactions for a particular month.

I need to prepare a report in Sheet 2 with the Branch and Product as criterias.
In Cell. A2, I have created a dropdown list for branches (after removing duplicates) and used Name Manager to create a Data Validation List.
I need the following in Cell B2 (Sheet 2)
a. A dropdown list of products from Col. B of Sheet 1
b. I need only the products list available against the branch selected in Cell A1 and should not display the products that are not available in the specific branch.
c. Duplicate product names to be removed and only unique names to be available in the dropdown list.
d. Option for autofill product names when one or more characters are typed.
e. Dropdown list should not contain blank entries
f. If possible Product names to be alphabetically displayed.

I tried to use Vlookup and for listing products against each branch in different columns, tried removing duplicates from this list in another column and using name manager for each branch. But since my list of branches and Products are more (20 + branches and 500 + products), I found it difficult to create multiple columns for vlookup and removing duplicates. Also had the problem of blanks in the drop down.

Is there any other options (VBA Code) to get what i want. I am using Office 2019 Professional and hence cannot use formulas avaialble in later versions (Sort / Unique, etc).

I tried viewing many threads in the forum, but was unable to find what i want. Threads available were mostly for higher versions of excel.

Thanks and regards
Subash D
 
Have you tried Post#29.
I got correct result
NOTE; I had already told you to use Worksheetevent for Sheet 2, not for Sheet 1. code should be removed from Sheet 1. Code is there in POst#24.
 
Last edited:
Upvote 0
Since you are having problem of slow here is the revised solution for Post#1.
Validation list.xlsm
ABCDEFGHIJKLMNOPQRSTUV
1BranchProductTypeUOMDateInv. No.PriceUnique BranchesSydneyIrelandJapanTokyoDelhiOhioNew JerseyBangkokBangalore  
2Sydney0.1ml 96 well PCR PlateGlasswareNos01-12-202455970Sydney0.1ml 96 well PCR Plate0.2ml 96 well PCR Plate-25's0.2ml PCR 8 Strip8 Strip CapsAcid Fast Stain KitAutobio-Cuvette 1000'sAVE-Buffer 40mlAVE-Cleanser I-500mlAVE-Cleanser II-40ml  
3Ireland0.2ml 96 well PCR Plate-25'sGlasswareBox02-12-202456013Ireland   Biomedical Waste Cover Green-SmallBiomedical Waste Cover Red-MediumBiomedical Waste Cover Yellow-MediumBarium Chloride 10% 500mlBenzidine Powder-25gmBiomedical Waste Cover Blue-Medium  
4Japan0.2ml PCR 8 StripGlasswareBox02-12-202456014Japan      Bio-Rad QC Level 1-5mlBio-Rad QC Level 2-5ml   
5Tokyo8 Strip CapsGlasswarePkt02-12-202456018Tokyo           
6DelhiAcid Fast Stain KitChemicalBox02-12-202456020Delhi           
7OhioAutobio-Cuvette 1000'sReagentNos02-12-202456021Ohio           
8New JerseyAVE-Buffer 40mlReagentBox02-12-202456022New Jersey           
9BangkokAVE-Cleanser I-500mlReagentBox02-12-202456023Bangkok           
10BangaloreAVE-Cleanser II-40mlReagentBox02-12-202456024Bangalore           
11New JerseyBarium Chloride 10% 500mlReagentBox02-12-202456026            
12BangkokBenzidine Powder-25gmReagentNos02-12-202456027            
13BangaloreBiomedical Waste Cover Blue-MediumReagentNos02-12-202456029            
14TokyoBiomedical Waste Cover Green-SmallReagentNos02-12-202456036            
15DelhiBiomedical Waste Cover Red-MediumReagentNos02-12-202456037            
16OhioBiomedical Waste Cover Yellow-MediumReagentNos02-12-202456039            
17New JerseyBio-Rad QC Level 1-5mlReagentNos02-12-202456040            
18BangkokBio-Rad QC Level 2-5mlReagentNos02-12-202456046            
Sheet 1
Cell Formulas
RangeFormula
L1:V1L1=INDEX($K$2:$K$48,COLUMNS($L$1:L$1))
K2:K18K2=IFERROR(INDEX($A$2:$A$44,AGGREGATE(15,6,ROW($A$2:$A$44)/(($A$2:$A$44<>"")*ISERROR(MATCH($A$2:$A$44,$K$1:$K1,0))),1)-ROW($A$1)),"")
L2:V18L2=IF(L$1="","",IFERROR(INDEX($B$2:$B$215,AGGREGATE(15,6,ROW($B$2:$B$215)/(ISERROR(MATCH($B$2:$B$215,$L$1:$L1,0))*($A$2:$A$215=L$1)),ROWS(L$2:L2))-ROW($B$1)),""))

Validation list.xlsm
ABCDEFG
1
2BangaloreAVE-Cleanser II-40ml
3
4
5
6Sl. NoTypeUOMDateInv. No.Price
71ReagentBox45628560240
8      
9      
Sheet 2
Cell Formulas
RangeFormula
A7:A9A7=IF(LEN(B7)>0,SUM(A6)+1,"")
B7:F9B7=IFERROR(INDEX('Sheet 1'!C$2:C$44,AGGREGATE(15,6,ROW('Sheet 1'!$C$2:$C$44)/(ISNUMBER(MATCH('Sheet 1'!$A$2:$A$44,'Sheet 2'!$A$2,0))*ISNUMBER(MATCH('Sheet 1'!$B$2:$B$44,'Sheet 2'!$B$2,0))),ROWS($C$7:$C7))-ROW($C$1)),"")
Cells with Data Validation
CellAllowCriteria
A2List=OFFSET(Master!$H$2,0,0,COUNTIF(Master!$H$2:$H$100,"?*"))
B2List=OFFSET('Sheet 1'!$K$2,0,MATCH($A2,'Sheet 1'!$L$1:$AJ$1,0),COUNTIF(INDEX('Sheet 1'!$L$2:$AJ$48,,MATCH($A2,'Sheet 1'!$L$1:$AJ$1,0)),"*?"))
 
Upvote 0

Sir I tried your formula in a different sheet. The formula is working fine, but the issue is not all the details are displayed,
for example. I have two Item names for the Instrument ABG (Col. X), but only one instrument is displayed in Col AL. But for all other intruments from Cols AI to BA the item names are properly displayed.

I am unable to find the issue. Can you please help me out to sort this issue.

I have attached the original file link for your reference.


Thanks in Advance
Subash D
 
Upvote 0
Change the formula in AH2 as below a nd copy to full required range.
Excel Formula:
=IF(AH$1="","",IFERROR(INDEX($Y$2:$Y$477,AGGREGATE(15,6,ROW($Y$2:$Y$477)/(ISERROR(MATCH($Y$2:$Y$477,AH$1:AH1,0))*($X$2:$X$477=AH$1)),1)-ROW($Y$1)),""))
 
Upvote 0
Change the formula in AH2 as below a nd copy to full required range.
Excel Formula:
=IF(AH$1="","",IFERROR(INDEX($Y$2:$Y$477,AGGREGATE(15,6,ROW($Y$2:$Y$477)/(ISERROR(MATCH($Y$2:$Y$477,AH$1:AH1,0))*($X$2:$X$477=AH$1)),1)-ROW($Y$1)),""))
Thanks for the speedy reply, it works fine now.

I also have another query. I need to upload this sheet to google sheets. will these formulas work in google sheets? I also have link of this sheet to another sheet in the same workbook which is to be uploaded to google sheets.

Thanks
Subash D
 
Last edited:
Upvote 0
In Column X data is arranged in sorted form. If it is always in the same form in the file a better and faster formula can be done. Is it Ok .
 
Upvote 0
For google sheets.
In AG2.
Excel Formula:
=UNIQUE(X2:X206)
In AH2 copied upto BZ2. If required extend further.
Excel Formula:
=IF(AH$1="","",unique(filter($Y$2:$Y$206,$X$2:$X$206=AH$1)))
 
Upvote 0
Sorry for the delayed reply.

Your Unique formula did not return the required results, but got this formula from another source which worked well in google sheets. this formula used "Agrregate" instead of unique and filter

=IF(AH$1="","",IFERROR(INDEX($Y$2:$Y$477,AGGREGATE(15,6,ROW($Y$2:$Y$477)/(ISERROR(MATCH($Y$2:$Y$477,$AH$1:$AH1,0))*($X$2:$X$477=AH$1)),ROWS(AH$2:AH2))-ROW($Y$1)),""))
 
Upvote 0

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top