How can I make xlookup return all results in a data validation cell drop down list?

aazmy

New Member
Joined
Mar 11, 2023
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hello all,

I have a wide range of employees data, I have been using normal Xlookup to get the Person Number by looking up the Employee name. However I came across case similar to the example below, there is a two idfferent employees with two different Person Number, but have the same exact name. So, I was looking for a way to return all the results in drop down list and I can choose the correct one from it.
I tried to put the xlookup into a data validation, but it returned the first result only as shown in the below example.
|Any help of getting all the results in the list?
Thanks in advance.
1678563474357.png
 

Attachments

  • 1678563041060.png
    1678563041060.png
    17.4 KB · Views: 12

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Is this the type of thing you mean?

Book1
AB
8Person_NumberPerson_Name
9219518Ahmed Mohamed
10247121Hossam Alaa
11103985Abdelrahman Mohamed
12277164Ahmed Mohamed
13
14
15Employee_NamePerson_Number
16Ahmed Mohamed219518
17277164
Sheet1
Cell Formulas
RangeFormula
B16:B17B16=FILTER($A$9:$A$12,$B$9:$B$12=A16,"")
Dynamic array formulas.
Cells with Data Validation
CellAllowCriteria
A16List=$B$9:$B$12
 
Upvote 0
Welcome to the MrExcel board!

For the future I suggest that you investigate XL2BB for providing sample data to make it easier for helpers by not having to manually type out sample data to test with. :)

Could you use something like this?
Use some helper columns. I have used D, E, ... but they can be any columns and they could be hidden once you enter the formula shown in D16 and copied down as far as you might ever need.
Then set up the Data validation as shown.

23 03 12.xlsm
ABCDEF
8NumberName
9219518Name 1
10247121Name 2
11103985Name 3
12277164Name 1
13
14
15NameNumber
16Name 1219518277164
17Name 3103985
18Name 1219518277164
19Name 2247121
20 
21 
DV
Cell Formulas
RangeFormula
D16:E16,D18:E18,D17,D19:D21D16=TRANSPOSE(FILTER($A$9:$A$12,$B$9:$B$12=A16,""))
Dynamic array formulas.
Cells with Data Validation
CellAllowCriteria
B16:B19List=D16#


This is the result when completing the Number for Name 1

1678581541289.png
 
Upvote 0
Actually, this would be more compact and "neater". Rather than copying down all the rows, just set up this top-right section and the altered DV as shown.

23 03 12.xlsm
ABCDEFGH
8NumberName
9219518Name 1Name 1219518277164
10247121Name 2Name 2247121
11103985Name 3Name 3103985
12277164Name 1
13
14
15NameNumber
16Name 1
17Name 3
18Name 1
19Name 2
DV (2)
Cell Formulas
RangeFormula
E9:E11E9=UNIQUE(B9:B12)
F9:G9,F10:F11F9=TRANSPOSE(FILTER($A$9:$A$12,$B$9:$B$12=E9,""))
Dynamic array formulas.
Cells with Data Validation
CellAllowCriteria
B16:B19List=XLOOKUP(A16,$E$9:$E$11,$F$9:$F$11)#
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,915
Members
452,366
Latest member
TePunaBloke

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