Build an Employee Lookup Sheet in Excel
By ExcelReady TeamUpdated 6 min read
The short answer
An employee lookup sheet has a staff table and a small lookup card. You type an employee ID into one cell, and XLOOKUP formulas fill in that person's name, department and other details from the table. Add "Not found" as XLOOKUP's fourth argument so a wrong ID shows a clear message instead of #N/A.
Key takeaways
- Keep one staff table with a unique ID in the first column, and build the lookup card next to it.
- Each card field is one XLOOKUP: the ID cell, the ID column, and the column to bring back.
- Lock the ID cell and the table ranges with $ so the card formulas can be copied.
- Use the fourth argument, such as "Not found", for IDs that don't exist.
- In Excel 2019 or older, use VLOOKUP with FALSE inside IFERROR instead.
On this page+
An employee lookup sheet in Excel lets anyone type an employee ID and instantly see that person's name, department, location and phone extension. You build it with one staff table and a small "lookup card" of XLOOKUP formulas, plus a friendly "Not found" message for wrong IDs. This project is useful practice for HR and admin roles, and it covers the lookup skills most Excel tests check.
What you're building#
The finished sheet has two parts side by side: the staff table (the data) and the lookup card (the formulas). You only ever type in one cell of the card, the ID.
Here is the staff table:
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | ID | Name | Department | Location | Extension |
| 2 | E-101 | Priya Shah | Finance | London | 2104 |
| 3 | E-102 | Tom Becker | Sales | Leeds | 2231 |
| 4 | E-103 | Aisha Khan | Operations | London | 2318 |
| 5 | E-104 | Mateo Silva | Sales | Bristol | 2240 |
| 6 | E-105 | Lena Ortiz | Finance | Leeds | 2107 |
| 7 | E-106 | Ken Watanabe | IT | London | 2402 |
Two rules keep the lookup reliable. Every ID must be unique, and the table should have no blank rows or merged cells.
Step 1: Build the lookup card with XLOOKUP#
Each field on the card is one XLOOKUP that searches the ID column and brings back a different column. XLOOKUP's shape is =XLOOKUP(what to find, where to look, what to bring back, [if not found]).
Put the labels in column G and the formulas in column H:
| Cell | Label | Formula | Result for E-104 |
|---|---|---|---|
| H1 | Employee ID | E-104 (typed) | |
| H2 | Name | =XLOOKUP($H$1,$A$2:$A$7,$B$2:$B$7,"Not found") | Mateo Silva |
| H3 | Department | =XLOOKUP($H$1,$A$2:$A$7,$C$2:$C$7,"Not found") | Sales |
| H4 | Location | =XLOOKUP($H$1,$A$2:$A$7,$D$2:$D$7,"Not found") | Bristol |
| H5 | Extension | =XLOOKUP($H$1,$A$2:$A$7,$E$2:$E$7,"Not found") | 2240 |
The $ signs lock the ID cell and the table, so you can copy H2 down and only change the return column. Press F4 on Windows or ⌘T on a Mac to add them. The XLOOKUP function guide explains every argument, and XLOOKUP in Excel for beginners has more examples.
Get the whole card from one formula#
XLOOKUP can return several columns at once. =XLOOKUP(H1,A2:A7,B2:E7) spills (fills) the name, department, location and extension across one row. To show them down a column like a card, wrap it in TRANSPOSE:
=TRANSPOSE(XLOOKUP(H1,A2:A7,B2:E7))Leave the cells below empty, or Excel shows #SPILL!. The one-formula version is neat, but separate formulas are easier for colleagues to read and edit.
Step 2: Handle IDs that don't exist#
When an ID isn't in the table, XLOOKUP returns #N/A unless you give it a fourth argument. With "Not found" in place, typing E-199 shows Not found in every field.
If a real ID still shows Not found, the data is usually the problem:
- Extra spaces: "E-104 " with a trailing space is a different value. Clean it with TRIM; see clean messy data with TRIM, CLEAN and PROPER.
- Numbers vs text: if IDs are plain numbers, one list may hold them as text. See numbers stored as text.
- Wrong range: the ID column must cover every row of the table.
Our guide to fixing #N/A errors in lookups goes through each cause.
Step 3: Make the ID a drop-down list#
A drop-down list stops typos, because people pick an ID instead of typing it.
- Select H1.
- Go to Data > Data Validation (Windows shortcut: Alt, A, V, V). On a Mac, use Data > Data Validation.
- Under Allow, choose List.
- In Source, type
=$A$2:$A$7, then click OK.
Create a drop-down list in Excel covers lists that grow as you add staff.
Step 4: Add search by name and by department#
The same table answers other questions with small changes.
Find an ID from a name. The ID column is to the left of the names, which VLOOKUP can't do but XLOOKUP can. With Lena Ortiz in H8:
=XLOOKUP(H8,B2:B7,A2:A7)The result is E-105. More ways to do this are in how to look up to the left.
Search by part of a name. Match mode 2 allows wildcards. With Khan in H15, this returns E-103:
=XLOOKUP("*"&H15&"*",B2:B7,A2:A7,"Not found",2)List everyone in a department. XLOOKUP stops at the first match, so use FILTER to get them all. With Sales in H11:
=FILTER(B2:B7,C2:C7=H11)
=COUNTIFS(C2:C7,H11)FILTER spills Tom Becker and Mateo Silva, and COUNTIFS returns 2. Our comparison of XLOOKUP vs FILTER explains when to use each.
Version note: building it in older Excel#
XLOOKUP and FILTER need Excel 2021, Excel 2024, Microsoft 365 or Excel for the web. In Excel 2019 or older, use VLOOKUP with an exact match inside IFERROR:
=IFERROR(VLOOKUP($H$1,$A$2:$E$7,2,FALSE),"Not found")Change the column number (2) for each field: 3 for Department, 4 for Location, 5 for Extension. VLOOKUP can't look left, so "find the ID from a name" needs INDEX and MATCH there. VLOOKUP vs XLOOKUP compares the two in detail.
How to extend the employee lookup sheet#
Once the card works, a few additions make it a real tool:
- Put the table on its own sheet and the card on a "Lookup" sheet. Reference it like
Staff!$A$2:$A$7; see reference another sheet. - Turn the staff list into a table (Ctrl+T on Windows, or Insert > Table) so new hires are included automatically.
- Protect the formulas so only H1 can be edited: protect a sheet and lock cells.
- Add start dates and calculate years of service with DATEDIF.
- Add a schedule or price list next: the weekly shift schedule project and the price list with discounts and tax use the same "table plus formulas" pattern.
This exact task, finding a person's details by ID and counting a department, appears often in hiring tests. See how to pass an Excel test for a job interview, the Excel interview questions you can practise, and the Excel skills every data analyst needs.
Practise it#
Fill in the Department field in the exercise on this page. Then work through the XLOOKUP lesson, and try the HR roster interview drill, which asks you to look up a salary, count a department and list its staff without being told which functions to use.
Try it yourself
This is a live spreadsheet. Type the formula in the green cell and press Enter.
The lookup card shows details for the ID in H1. In H3, use XLOOKUP to return that employee's Department (C2:C7). Show "Not found" if the ID doesn't exist.
| A | B | C | D | E | F | G | H | I | |
|---|---|---|---|---|---|---|---|---|---|
| 1 | Extension | E-104 | |||||||
| 2 | |||||||||
| 3 | Department | ||||||||
| 4 | |||||||||
| 5 | |||||||||
| 6 | |||||||||
| 7 | |||||||||
| 8 | |||||||||
| 9 | |||||||||
| 10 |
Tip: Find H1, in the ID column A2:A7, bring back the Department column C2:C7, and add "Not found" as the fourth part. The result is Sales.
Practise this in a lesson
Frequently asked questions
How do I look up an employee by ID in Excel?
Use XLOOKUP: =XLOOKUP(H1,A2:A7,B2:B7) finds the ID in H1 in the ID column A2:A7 and returns the name from B2:B7. In older Excel, use =VLOOKUP(H1,A2:E7,2,FALSE).
Why does my employee lookup return #N/A?
#N/A means the ID wasn't found. Check for typos, extra spaces, and IDs stored as numbers in one place and text in another. Add a fourth argument such as "Not found" to show a message instead.
Can I look up an employee by name instead of ID?
Yes. Point XLOOKUP at the name column: =XLOOKUP(H8,B2:B7,A2:A7) returns the ID for the name in H8. Names are less reliable than IDs, because two people can share a name and the first match wins.
How do I list everyone in one department?
Use FILTER, which returns every match: =FILTER(B2:B7,C2:C7=H11). XLOOKUP returns only the first match, so it suits single-person lookups.
Can I make the ID a drop-down list?
Yes. Select the ID input cell, go to Data > Data Validation, choose List, and set the source to the ID column, such as =$A$2:$A$7.