Excel Guide · Prompt: “Look up employee ID in A2 inside B2:B6 and return Department and Salary”
Return Multiple Columns with One Excel XLOOKUP Formula
Verified by LiveFormulaLab Engineering Team • Updated November 2026
Use a single XLOOKUP formula to spill multiple adjacent columns in Excel 365. Test live and compare with SQL and Pandas.
Verified Excel Syntax
=XLOOKUP(A2, B$2:B$6, C$2:C$6, "Not Found")How This Formula Works (Step-by-Step)
Unlike VLOOKUP which needs separate formulas or column index arrays, XLOOKUP returns an entire multi-column range automatically when the return_array spans multiple columns.
Step 1: Point lookup_array to your unique ID column (B2:B6).
Step 2: Expand return_array across all target columns (e.g., C2:D6) to spill both Department and Salary in one formula.
Formula Syntax & Arguments Breakdown
Searches a single key column using XLOOKUP with locked range anchors ($) and returns corresponding fields or a multi-column spilled array across adjacent columns.
| Argument / Clause | Requirement | Data Type | Role & Behavior |
|---|---|---|---|
lookup_value (A2) | Required | Cell / Value | Lookup key on the current row such as Employee ID, SKU, or Email. |
lookup_array (B$2:B$6) | Required | Single Column | Column searched for an exact match; dollar signs lock the vertical boundaries when copied down. |
return_array (C$2:C$6 or C$2:E$6) | Required | 1D or Multi-Column Range | Single column or contiguous multi-column block whose matching row values are returned. |
if_not_found ("Not Found") | Optional | Any Value | Built-in fallback string or 0 returned when the lookup key is absent. |
3 Real-World Use Cases
- Auto-filling Customer Name, Tier, and Account Owner from a single Account ID.
- Pulling Product Title, Cost, and Margin into an invoice template simultaneously.
- Syncing HR directory fields across multi-sheet headcount models.
Cross-Platform Equivalents
- Excel
=XLOOKUP(A2, B2:B6, C2:D6, "Not Found")- SQL
SELECT l.lookup_id, e.department, e.salary FROM lookups l LEFT JOIN employees e ON l.lookup_id = e.employee_id;- Python Pandas
df.merge(employees[['Employee ID', 'Department', 'Salary']], left_on='Lookup ID', right_on='Employee ID', how='left')
Common Mistakes & Pro Tips
Pitfalls & How to Fix Them
Mistake: Forgetting "
quot; locks on B2:B6 causes the lookup array to drift downward as you drag the formula to row 20.Fix: Anchor lookup and return row bounds with $ (B$2:B$6 and C$2:E$6) or reference structured Table columns.
Mistake: Placing text or formulas inside cells to the right of a multi-column XLOOKUP triggers a #SPILL! error.
Fix: Clear horizontal neighbor cells so Excel can spill all returned columns cleanly, or wrap in CHOOSECOLS().
Mistake: Mixing number-stored-as-text IDs ("1042") against numeric IDs (1042) returns "Not Found".
Fix: Standardize key types with TEXT() or VALUE() before running the lookup.
Engineering Pro Tips
- Use CHOOSECOLS(XLOOKUP(A2, B$2:B$6, C$2:F$6), 1, 3) in Excel 365 to cherry-pick non-adjacent return columns in one formula.
- Set the optional 5th argument (match_mode) to 2 when matching partial wildcard keys like "*Pro*".
- Set the optional 6th argument (search_mode) to -1 to retrieve the most recent bottom-most transaction instead of the first.
Frequently Asked Questions
- What causes a #SPILL! error when returning multiple columns?
- A cell to the right of the formula contains text or formatting blocking the dynamic spill range. Clear adjacent cells.
- Can I return non-adjacent columns with XLOOKUP?
- Yes, wrap the return columns in CHOOSECOLS or HSTACK inside XLOOKUP.
- Does XLOOKUP work inside Excel Tables?
- Yes, though spilling formulas cannot live inside structured Table columns—place them outside or return one column per formula.
Related Formulas & Guides
- Remove Everything After a Character in Excel (LEFT + FIND) — Strip suffixes, query parameters, or tags after a hyphen, slash, or @ symbol in Excel using LEFT and FIND. Copy and test the formula live.
- Count Unique Values with Criteria in Excel — Count distinct customers, orders, or IDs that match a condition in Excel without pivot tables. Interactive sandbox included.
- Calculate Business Days Between Two Dates in Excel — Compute working days between two dates in Excel excluding weekends and holidays with NETWORKDAYS and DATEDIF. Copy and test live.
- Find Conditional Maximum Value in Excel with MAXIFS — Find the largest value matching one or more criteria in Excel using MAXIFS. Copy the formula and compare SQL and Python equivalents.