Creating 2 linked drop downs

hungledink

Board Regular
Joined
Feb 20, 2012
Messages
88
Office Version
  1. 365
I have some data, names in column A and corresponding account number in column B.

I've made a drop-down lists with data validation, one in cell C1 for the data in column A, and in D1 for data in column B.

Is it possible to have it so that if a selection is made in cell C1, a selection from column A, then the value in cell D1 will auto populate with the corresponding value from column B and vice versa?
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Not really. If you choose a value from the dropdown, it will overwrite the formula. But you can add an adjacent "suggestion" cell with the value using XLOOKUP.

Book4
ABCDE
1NameAccountNameListAccountList
2AdamAdam-1AdamAdam-1
3BobBob-1BobBob-1
4CarolCarol-1CarolCarol-1
5
6Enter nameAdam
7Suggested name 
8
9Enter account number
10Suggested accountAdam-1
Sheet1
Cell Formulas
RangeFormula
D2:D4D2=Data[Name]
E2:E4E2=Data[Account]
B7B7=XLOOKUP(B9,Data[Account],Data[Name],"")
B10B10=XLOOKUP(B6,Data[Name],Data[Account],"")
Dynamic array formulas.
Cells with Data Validation
CellAllowCriteria
B6List=$D$2#
B9List=$E$2#


Columns D and E contain dynamic arrays in order to update the dropdown list as new names are added to the data table. They can be hidden or placed in another sheet.
 
Upvote 0
Don't know whether the proposal from @Automatrix solve your problem.

If Not, then you might try the following (requires XL 365 or other Dynamic array compliant versions):
-create in S1 a first list using the formula
Excel Formula:
=LET(dColA;A2:A15;dColB;B2:B15;fVal;D1;fArr;SE(fVal="";SE(dColA<>"";dColA;""); SE(dColB=fVal;dColA;""));DATI.ORDINA(UNICI(fArr)))

-create the second list in T1 using the formula
Excel Formula:
=LET(dColA;A2:A15;dColB;B2:B15;fVal;D1;fArr;SE(fVal="";SE(dColA<>"";dColA;""); SE(dColB=fVal;dColA;""));DATI.ORDINA(UNICI(fArr)))

Now set the data validation for C1 using as source of the list the formula =S1#
Repeat for D1 using the formula =T1#

See the attached image to see how the validation lists changes in my test sheet

Then try and see how this behave for you
 

Attachments

  • CONVALIDA_Immagine 2022-10-13 153450.jpg
    CONVALIDA_Immagine 2022-10-13 153450.jpg
    59.4 KB · Views: 4
Upvote 0
Don't know whether the proposal from @Automatrix solve your problem.

If Not, then you might try the following (requires XL 365 or other Dynamic array compliant versions):
-create in S1 a first list using the formula
Excel Formula:
=LET(dColA;A2:A15;dColB;B2:B15;fVal;D1;fArr;SE(fVal="";SE(dColA<>"";dColA;""); SE(dColB=fVal;dColA;""));DATI.ORDINA(UNICI(fArr)))

-create the second list in T1 using the formula
Excel Formula:
=LET(dColA;A2:A15;dColB;B2:B15;fVal;D1;fArr;SE(fVal="";SE(dColA<>"";dColA;""); SE(dColB=fVal;dColA;""));DATI.ORDINA(UNICI(fArr)))

Now set the data validation for C1 using as source of the list the formula =S1#
Repeat for D1 using the formula =T1#

See the attached image to see how the validation lists changes in my test sheet

Then try and see how this behave for you
can i request an example sheet? this might be an answer to my question as i have long list and the data available could go to 'Account' or 'Name' and if it is possible to have a 3rd selection. Thank you!
 
Upvote 0
A demo file can be downloaded from here: CrossValidation.xlsx

You need to modify the formulas in S1-T1 if the list in columns A-B is longer than 20 lines
Data validation is set in cells C1-D1
 
Upvote 0

Forum statistics

Threads
1,214,851
Messages
6,121,931
Members
449,056
Latest member
denissimo

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