Lookup · Excel formula

Look up an employee department

XLOOKUP finds the employee in column A and returns the department from column B on the same row.

Illustrated spreadsheet concept

Use this formula

=XLOOKUP(D2,A2:A5,B2:B5,"Not found")

The example below uses the column letters and row numbers in the formula. Enter it in a blank cell after the sample data.

See the cells and result

Visual example for Look up an employee department with sample rows and expected result

Example data

RowEmployeeDepartmentFind
2AvaSalesCam
3BoSupport
4CamFinance
5DeeHR

Expected result: Finance.

Why it works

XLOOKUP finds the employee in column A and returns the department from column B on the same row.

Check this: XLOOKUP requires a supported recent Excel version.

Excel versions and testing

Microsoft 365, Excel 2021, or Excel 2024. XLOOKUP is unavailable in Excel 2016 and 2019.

This original example has been checked against the browser formula engine and the downloadable workbook structure. The workbook has not been verified in every Excel edition. Microsoft function reference.

Common mistake and fix

If #NAME? appears, check your Excel version. In Excel 2016 or 2019, use INDEX and MATCH for an equivalent lookup. If the result is missing, check spaces in the lookup value.

Try it yourself

Change a number or label in the data and predict the new result. Use the practice lab to test a supported formula, or download the data to work in Excel.

Try this example onlineDownload Excel workbookDownload CSV