Excel guide · 6 min read
How to return multiple columns with XLOOKUP
=XLOOKUP(H2,A2:A9,B2:F9) returns the whole matching row and spills it across five cells (Excel 365 and Excel 2021 or later). For columns that are not next to each other, wrap the return range in CHOOSECOLS. If the cells to the right are not empty you get #SPILL!; clear them and the row appears.Sample data
Every result on this page was calculated from this sheet by the same spreadsheet engine the Cellwise app uses.
| A | B | C | D | E | F | G | H | |
|---|---|---|---|---|---|---|---|---|
| 1 | SKU | Product | Category | Price | Stock | Supplier | Find SKU | |
| 2 | KT-101 | Chef's knife 8in | Knives | 64.5 | 38 | Sakai Steel | KT-208 | |
| 3 | KT-114 | Paring knife | Knives | 22 | 0 | Sakai Steel | ||
| 4 | KT-208 | Cast iron skillet | Cookware | 48 | 15 | Ironhill | ||
| 5 | KT-215 | Dutch oven 5qt | Cookware | 89 | 7 | Ironhill | ||
| 6 | KT-302 | Bamboo board | Prep | 19.95 | 120 | GreenCut | ||
| 7 | KT-310 | Mixing bowls (3) | Prep | 27.5 | 44 | Nordbake | ||
| 8 | KT-405 | Digital scale | Tools | 31 | 26 | Nordbake | ||
| 9 | KT-412 | Instant thermometer | Tools | 24 | 0 | Thermo Co |
Download this sheet as an Excel practice file (.xlsx)
One XLOOKUP, several columns
The catalog has the SKU in column A and five details beside it. You want everything about the SKU typed in H2. Instead of pointing return_array at one column, point it at all of them: =XLOOKUP(H2,A2:A9,B2:F9). Excel finds KT-208 in row 4 and returns that row of B:F, so the formula cell shows "Cast iron skillet" and the four cells to its right fill with Cookware, 48, 15 and Ironhill.
You type the formula once, in the first cell only. The other four cells are a spill range: they show a faint blue border when selected, and their formula appears greyed out in the formula bar. You cannot type over or delete one of them on its own. To change the result, edit the first cell.
This needs dynamic arrays, so Excel 365, Excel 2021, Excel 2024 or Excel for the web. Older versions do not have XLOOKUP at all; see the INDEX/MATCH section below.
Pick non-adjacent columns or change their order with CHOOSECOLS
Often you want only some of the columns, say the product, the stock and the supplier, but not the category or price. Wrap the return range in CHOOSECOLS and list the column numbers you want, counted from the left edge of that range: =XLOOKUP(H2,A2:A9,CHOOSECOLS(B2:F9,1,4,5)) returns Cast iron skillet, 15 and Ironhill.
The numbers also set the order, so CHOOSECOLS(B2:F9,5,1) puts the supplier first and the product second. CHOOSECOLS is in Excel 365 and Excel 2024; it is not in Excel 2021. In 2021, use one XLOOKUP per column instead (next section).
Counting columns by number has the same weakness as VLOOKUP: if someone inserts a column inside B:F, column 4 becomes a different field. If the layout changes often, look the column up by its header, as shown further down.
One XLOOKUP per column (works in every XLOOKUP version)
If you want the results laid out under your own headings, in any order, with gaps between them, write one XLOOKUP per output cell. The trick is the dollar signs: lock the SKU cell and the lookup column, and leave the return column unlocked so it moves when you fill right.
=XLOOKUP($H$2,$A$2:$A$9,B2:B9) returns the product. Fill it one cell right and the last range becomes C2:C9 (category), then D2:D9 (price), and so on. If you also want to fill down for a list of SKUs in H2:H6, use $H2 and B$2:B$9 so the SKU row moves but the return range stays on rows 2 to 9.
This version never causes #SPILL!, and each cell keeps its own number format. It is the safer choice inside an Excel table, because spilling formulas are not allowed in tables.
Result: Cast iron skillet
Cast iron skillet. Filled right, the copies return Cookware, 48, 15 and Ironhill.
Return array the wrong size gives #VALUE!
XLOOKUP needs the return array to have exactly as many rows as the lookup array. Here the lookup column stops at row 9 but the return range runs to row 10, one row too many, so Excel returns #VALUE! instead of guessing how the two line up.
This usually happens after you add rows and only update one of the ranges, or when you type the ranges by hand. Select the formula, press F2 and check that the coloured boxes start and end on the same rows. Using full columns on both sides (A:A and B:F) or an Excel table keeps them in step automatically.
Result: #VALUE!
#VALUE!, because A2:A9 has 8 rows and B2:F10 has 9. Make both ranges end on row 9.
#SPILL!: something is in the way
A multi-column XLOOKUP needs every cell it spills into to be empty. If any of them holds a value, a formula, a space or even an empty string from another formula, the whole result is replaced by #SPILL!. Click the error and select the warning icon: Select Obstructing Cells takes you to the culprit.
The other common cause is the table rule. Dynamic array formulas that spill are not supported inside an Excel table, so a multi-column XLOOKUP typed into a table column always shows #SPILL!. Put it outside the table, or use one XLOOKUP per column as above.
- Click the cell showing #SPILL!.
- Click the yellow warning icon next to it and choose Select Obstructing Cells.
- Delete or move whatever is in those cells (press Delete, not the space bar).
- The row spills as soon as the range is clear.
Choose columns by header, and the INDEX/MATCH fallback
To return the column named in a header cell, so the formula survives inserted columns, match the header as well as the SKU. With INDEX and MATCH that is a two-way lookup: the first MATCH finds the row, the second finds the column. The same idea with XLOOKUP is to nest one inside the other: =XLOOKUP($H$2,$A$2:$A$9,XLOOKUP(I$1,$B$1:$F$1,$B$2:$F$9)), where I1 holds a header such as Supplier.
INDEX/MATCH also works in Excel 2019 and earlier, which have no XLOOKUP. In those versions use one formula per column, such as =INDEX(B$2:B$9,MATCH($H$2,$A$2:$A$9,0)) filled right. In Excel 365 you can return the whole row at once with =INDEX(B2:F9,MATCH(H2,A2:A9,0),0); the 0 for the column means all columns, and it spills like XLOOKUP does.
Result: Ironhill
Ironhill, the supplier for KT-208, found by its header rather than a column number.
XLOOKUP returns the first match only: use FILTER for all of them
XLOOKUP stops at the first row that matches. That is right for a unique key like a SKU, but if you look up a supplier, you get one product even when the supplier has several. Ironhill makes both the skillet and the Dutch oven.
FILTER returns every matching row, with as many columns as you give it. It spills down and across, so leave room in both directions.
Result: spills 2 rows × 4 columns
| Cast iron skillet | Cookware | 48 | 15 |
| Dutch oven 5qt | Cookware | 89 | 7 |
Two rows, four columns: Cast iron skillet, Cookware, 48, 15 and Dutch oven 5qt, Cookware, 89, 7.
Common mistakes
Filling a multi-column XLOOKUP to the right
Each copy tries to spill over the previous one and you get #SPILL!. Enter the spilling version once, or use one XLOOKUP per column with the return range unlocked.
Lookup and return ranges on different rows
A2:A9 must pair with B2:F9, not B1:F9 or B2:F10. Mismatched sizes give #VALUE!, and offset ranges return the wrong row without any error.
Counting columns in CHOOSECOLS from column A
CHOOSECOLS counts from the first column of its own range. In CHOOSECOLS(B2:F9,1,4), 1 is column B and 4 is column E.
Typing the formula inside an Excel table
Spilling formulas are not allowed in tables. Place the lookup outside the table or use one XLOOKUP per column.
FAQ
Can XLOOKUP return multiple columns?
Yes. Make return_array more than one column wide, for example =XLOOKUP(H2,A2:A9,B2:F9). In Excel 365 and Excel 2021 or later the matching row spills into the cells to the right.
How do I return non-adjacent columns with XLOOKUP?
Wrap the return range in CHOOSECOLS: =XLOOKUP(H2,A2:A9,CHOOSECOLS(B2:F9,1,4,5)). In Excel 2021, which lacks CHOOSECOLS, write one XLOOKUP per column instead.
Why does my XLOOKUP return only one value instead of the whole row?
Usually return_array is a single column: check that it covers every column you want, such as B2:F9 rather than B2:B9. If the formula shows an @ before XLOOKUP, which Excel adds to some formulas from older files, it is forced to one value; remove the @.
How do I return multiple rows that match, not just the first?
XLOOKUP only returns the first match. Use FILTER instead: =FILTER(B2:E9,F2:F9="Ironhill") returns every row for that supplier.
Can I use XLOOKUP to return multiple columns in Excel 2019?
No, Excel 2019 does not have XLOOKUP. Use INDEX and MATCH, one formula per column: =INDEX(B$2:B$9,MATCH($H$2,$A$2:$A$9,0)), filled right.
Functions used
XLOOKUPModern lookup in any directionINDEXValue at a positionMATCHPosition of a valueFILTERKeeps matching rows, spills
Related guides
- XLOOKUP with multiple criteria
- XLOOKUP if not found: return a blank, 0 or text
- How to return multiple matches in Excel
- #SPILL! error in Excel
- Excel formulas cheat sheet: the 25 everyone should know
- How to find the highest and lowest value in Excel
- How to use INDEX MATCH with multiple criteria
Updated