Combining two Xlookup function

ammykhan

Board Regular
Joined
Apr 23, 2022
Messages
54
Office Version
  1. 2021
Platform
  1. Windows
Hey All friends👋,

Can I get suggestion how to combine two lookup functions, I have a situation where I have to lookup customer data using their employee id but some customer forgets to give their details in such a scenario I need to filter the data by making use of their name instead. Want to make a combined formula to filter data by using either their Name or Employee Id, is there a way to combine two lookup functions for keeping our Excel sheet simple. The formula I'm trying to build shall be more or less like the one below.

=OR(XLOOKUP($D2,Staff_no, Location), XLOOKUP($D2,Name, Location)

Any advice from my senior fellows will be highly appreciated so I can further my insight in MS Excel, thanks in advance ☺️
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
is there a way to combine two lookup functions for keeping our Excel sheet simple.
Possibly, but we would need to see what your Excel sheet looks like. Can you give us some smallish (10-20 rows) of dummy but representative sample data and the expected results with XL2BB so that we can see what data you are dealing with and what results you would want from it?
 
Upvote 0
Filter is quite different to Xlookup. Xlookup will return a single result while Filter can return multiple results.
If you just wanted a single result for both you could make use of the if not found position.
=xlookup( lookup_value, lookup_array, return_array, if_not_found)
eg =XLOOKUP($D2, Staff_no, Location, XLOOKUP($D2,Name, Location))
You could also put Filter in that position but you would need room for it to Spill.

PS: You did not make your link available to anyone with the link and we can't access it,
 
Upvote 0
Filter is quite different to Xlookup. Xlookup will return a single result while Filter can return multiple results.
If you just wanted a single result for both you could make use of the if not found position.
=xlookup( lookup_value, lookup_array, return_array, if_not_found)
eg =XLOOKUP($D2, Staff_no, Location, XLOOKUP($D2,Name, Location))
You could also put Filter in that position but you would need room for it to Spill.

PS: You did not make your link available to anyone with the link and we can't access it,
Yup, you were right I had to change the accessibility option in drive, the excel sheet I have is very simple one, I have four columns in the sheet i.e Staff ID, Name, Mailbox Number & Location but the sheet I have is composed of 20k rows to say filter I meant to extract the meaningful information from the dataset based on either Staff ID or name, by using the 'filter' word I didn't mean at all to ADD this function into my formula
 
Upvote 0
Your Excel sheet does not include this ..

Yes off course I didn't include it because I don't know how to do it, as I mentioned in the query that I'm trying to combine two XLOOKUP functions, it will be quite confusing / cumbersome for me to make two separate worksheets for filtering the same data based on Staff Id / Name, currently if a customer forgets to give their employee id, I simply use CTRL+F which isn't a good way to find data for large number of people. So still I'm able to carry on my work despite my limited experience in tech but my eagerness to become an excel-pro led me to seek your help on this forum.
 
Upvote 0
I tried to explain the problem from my side quite well but probably I didn't convey my msg to you properly,sorry for wasting your time on this.. So, I enter the data now for both type, trying to combine them into one, I don't know if we can do that or not, pls check it.


Thanks a lot for the motivation,
 
Upvote 0
Something like this then?

my_checklist01 (1).xlsx
ABCD
1Location MailboxNameID
2DSO4251259532
3DSO4928IL SUK
4MS7572JI Hyun
5GHD4470268845
6OBD7693378485
7GHD10267jin lee
8Sarab11808na rae
CC
Cell Formulas
RangeFormula
A2:A8A2=XLOOKUP(D2,Staff_No,Location,XLOOKUP(C2,Name,Location))
B2:B8B2=XLOOKUP(D2,Staff_No,Mail,XLOOKUP(C2,Name,Mail))
Named Ranges
NameRefers ToCells
Location='Main Sheet'!$D$2:$D$20A2:A8
Mail='Main Sheet'!$C$2:$C$20B2:B8
Name='Main Sheet'!$B$2:$B$20A2:B8
Staff_No='Main Sheet'!$A$2:$A$20A2:B8
 
Upvote 0
Solution

Forum statistics

Threads
1,215,071
Messages
6,122,964
Members
449,094
Latest member
Anshu121

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