How can I return a room number for a person when names are not unique?
Quick answer
Do not use a name alone if it can match multiple people. Look up the room with a genuinely unique identifier, such as an assigned person ID. If you must combine fields, build a key from details that distinguish the records, then check for duplicates before using it. In Excel, XLOOKUP returns the first match it finds, so a repeated name can produce the wrong room without signaling ambiguity. [S1][S2]
The question, the details, the next step.
A practical checklist
Prefer a person ID intended to identify one record.
If combining fields, choose details that can distinguish people in these records.
Create the proposed key consistently in the records and lookup value.
Review the key column for duplicates and investigate repeated keys.
Decide how users should handle a missing or ambiguous match.
Confirm your Excel version supports the lookup function you plan to use.
A few more useful answers
Does XLOOKUP tell me when a name appears more than once?
Is name plus department always a unique key?
No. It is suitable only if that combination distinguishes every relevant record. Review the proposed key for duplicates; the fields alone do not establish uniqueness. [S2]
What if my Excel version does not support XLOOKUP?
Microsoft lists XLOOKUP as unavailable in Excel 2016 and 2019. Check the functions available in your version, while keeping the same matching rule: use a verified unique key rather than a name that can repeat. [S1]
Sources
References used for this guide.
- [S1] XLOOKUP function — Microsoft Support support.microsoft.com · Checked
- [S2] Find and remove duplicates — Microsoft Support support.microsoft.com · Checked
