FxFormula Drills

XLOOKUP to return more than one column

In Excel 2021, Excel 2024, Microsoft 365, and Google Sheets, XLOOKUP spills every column of its return range, so one formula can bring back a price and a quantity. Excel 2019 does not have XLOOKUP. A pair of formulas, one return column each, works anywhere XLOOKUP works and is what you should type when a checker grades a single cell. INDEX/MATCH can do the same pair.

Syntax

One column

XLOOKUP(lookup_value, lookup_array, return_array)

return_array is a single column. The result is one value. Call it again with a second return column when you need another field from the same row.

Several columns in Excel

XLOOKUP(lookup_value, lookup_array, first_column:last_column)

When the return range is wider than one column, Excel and Google Sheets spill the whole row of results to the right of the formula. Neighboring cells must be empty or you get a #SPILL! error in Excel.

INDEX and MATCH, one field at a time

INDEX(return_column, MATCH(lookup_value, lookup_column, 0))

Repeat INDEX with a different return column and the same MATCH. This is the version for Excel without XLOOKUP, and it never depends on a spill.

Comparison

QuestionTwo XLOOKUPsOne spilling XLOOKUPINDEX/MATCH
What you typeOne formula per fieldOne formula, a wide return rangeOne INDEX per field, MATCH shared or repeated
Excel 2019 and earlierNo XLOOKUPNo XLOOKUPWorks
Excel 2021, Microsoft 365, Google SheetsWorksSpills the extra columnsWorks
Formula Drills checkerEach formula returns its own valueA two-column return evaluates to #VALUE! in this engineEach INDEX returns its own value
Empty cells to the rightNot requiredRequired in Excel or the spill is blockedNot required

Worked examples

Price and quantity as two formulas

E2 is Book. The price is in column B and the quantity is in column C. Two XLOOKUP formulas, or two INDEX/MATCH formulas, each return one of those fields.

Book is 12 dollars and there are 2 in stock.
RowABCDE
1ProductPriceQtyFind
2Pen1.54Book
3Book122
4Lamp241
  • =XLOOKUP(E2,A2:A4,B2:B4) → 12
  • =XLOOKUP(E2,A2:A4,C2:C4) → 2
  • =INDEX(B2:B4,MATCH(E2,A2:A4,0)) → 12
  • =INDEX(C2:C4,MATCH(E2,A2:A4,0)) → 2

Both lookups search A2:A4 for Book. The first returns B, the price 12. The second returns C, the quantity 2. The MATCH position is 2 in both INDEX formulas, which is why a model sometimes calculates MATCH once in a helper cell and points both INDEX formulas at it.

A two-column return range in this checker

The Excel formula for both fields at once is a return range from the price through the quantity. Here is that formula evaluated by the same engine the drills use.

Book's price and quantity sit side by side in B and C.
RowABCDE
1ProductPriceQtyFind
2Pen1.54Book
3Book122
4Lamp241
  • =XLOOKUP(E2,A2:A4,B2:C4) → #VALUE!

Excel 2021, Excel 2024, Microsoft 365, and Google Sheets spill 12 and 2 across two cells from this formula, as long as the cell to the right is empty. Formula Drills' engine does not spill that return range. It returns #VALUE!. That is why the graded drills ask for one return column. Type the two formulas from the previous example when you are practicing here, and use the wide return range only in a desktop or Google sheet that spills.

When to use which

Use two formulas when each answer has its own labeled cell

A price cell and a quantity cell should each contain a formula that fills that one cell. The sheet stays obvious, and it still works if a note gets typed beside the price. This is also the shape the premium XLOOKUP drill grades.

Use one spill when you are building a row in Microsoft 365 or Google Sheets

A quote line that should appear as price, quantity, and extended amount can start with one XLOOKUP whose return range covers those columns. Leave the spill area empty. If you might open the file in Excel 2019, do not depend on the spill.

Use INDEX/MATCH when XLOOKUP is not available

Repeat INDEX for each column you need and keep the MATCH identical. You get the same two numbers, 12 and 2, without a function the older workbook cannot run.

Common mistakes

Expecting the wide formula to fill two graded cells here

The engine result for XLOOKUP with return range B2:C4 is #VALUE!, not 12 in one cell and 2 in the next. Split the return ranges.

Blocking a spill in desktop Excel

If the cell to the right of a spilling XLOOKUP already holds a label or a note, Excel shows #SPILL! and returns nothing. Clear that cell or switch to one formula per column.

Copying the first formula and forgetting to change the return column

A second XLOOKUP that still points at B2:B4 will show the price again where you wanted the quantity. Read the return range after you copy.

Returning columns that do not share the lookup rows

B2:B4 and C1:C3 are not the same rows. The quantity would come from the wrong line. Keep the return range aligned with the lookup range.

Versions and compatibility

XLOOKUP itself requires Excel 2021, Excel 2024, Microsoft 365, Excel for the web, or Google Sheets. A multi-column spill is a dynamic-array behavior of those same Excel versions and of Google Sheets. Excel 2019 has neither XLOOKUP nor that spill.

INDEX and MATCH, one column at a time, work in older Excel and in Google Sheets.

The #VALUE! shown for the wide return range is the result in Formula Drills' formula engine. Do not read it as the result Excel shows for the same formula.

Practice on Formula Drills

Free drills are open with no account. Premium drills show the problem to everyone and grade the sheet for subscribers.

Free exercises

Premium exercises

Function pages

FAQ

Can one XLOOKUP return the whole row?

In Excel 2021 and later, and in Google Sheets, yes, if the return range covers that row's fields and the spill area is empty. In this site's checker, split the return into one column per formula.

How do I return columns that are not next to each other?

Use a separate XLOOKUP or INDEX for each column. A single rectangular return range can only cover a block of neighboring columns.

Does VLOOKUP return multiple columns?

One VLOOKUP returns one column index. You write a second VLOOKUP with a different index, or you switch to XLOOKUP or INDEX/MATCH. There is a drill for the single-column case.

What if the product is missing?

Add the if_not_found argument to each XLOOKUP, or wrap each lookup in IFNA. A spill does not remove the need to decide what a miss should show.