Returning Whole Rows or Columns
Spill multiple results from a single XLOOKUP.
Returning Whole Rows or Columns is a free Excel Formulas Academy lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Excel Formulas Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
More Than One Answer
So far XLOOKUP has returned a single value. But it can also return a whole row or column of data at once.
When a formula returns many values, they spill into the neighboring cells automatically. This lets one XLOOKUP fill an entire mini-record.
=XLOOKUP(D2, A2:A20, B2:E20)Widening the Return Array
The trick is to make the return array span several columns. Instead of returning just B2:B20, return B2:E20.
XLOOKUP finds the matching row, then hands back every column in that row of the return array. One formula, four results.
=XLOOKUP(D2, A2:A20, B2:E20)How Spilling Looks
Type the formula in a single cell, say F2, and press Enter. The values appear across F2, G2, H2, and I2.
A faint blue border outlines the spill range. You only edit the top-left cell; the rest are filled by the spill and cannot be changed directly.
=XLOOKUP(D2, A2:A20, B2:E20)A Worked Example
An employee table has ID in column A and name, department, role, and salary in columns B through E.
Type an ID into D2 and one XLOOKUP returns the entire record. Change the ID and the whole row updates instantly - a tiny lookup tool in a single formula.
=XLOOKUP(D2, A2:A100, B2:E100, "Not found")Returning a Column Instead
The same idea works vertically. If you search across a row of headers, you can return an entire column of results.
Here XLOOKUP searches the header row B1:E1 for a label in D2 and spills down the full column B2:E50 beneath the matching header.
=XLOOKUP(D2, B1:E1, B2:E50)Spill References With the Hash
Once a formula spills, you can refer to the entire spilled range using the cell plus a hash, like F2#.
This is powerful: a SUM over a spilled row stays correct even if the row's width changes, because F2# always means "the whole spill from F2".
=SUM(F2#)Combining With Other Functions
Because the result is an array, you can feed it directly into functions that accept ranges.
For example, wrap the lookup in SUM to total a returned row of monthly figures, all in one formula with no helper cells.
=SUM(XLOOKUP(D2, A2:A20, B2:M20))Make Room to Spill
A spilling formula needs empty cells to fill. If any cell in the spill path already contains data, XLOOKUP returns a #SPILL! error.
The fix is simple: clear the blocking cells, or move the formula to a clear area. The spill range must be completely empty.
=XLOOKUP(D2, A2:A20, B2:E20)Headers That Update Too
For a polished lookup card, you can spill the field headers as well.
Place one XLOOKUP that returns the data row, and above it reference the header range. When the spill widens or narrows, your labels still line up with the returned columns.
=XLOOKUP(D2, A2:A100, B2:E100, "No match")Two-Way Lookup Preview
You can even nest one XLOOKUP inside another. The inner one returns a whole column, and the outer one picks a single cell from it.
This produces a true two-way lookup - matching both a row and a column - entirely with XLOOKUP. It is a neat alternative to INDEX-MATCH-MATCH.
=XLOOKUP(E1, A1:A20, XLOOKUP(D2, B1:M1, B2:M20))Spilling Recap Setup
You now know XLOOKUP can return more than one value:
- A multi-column return array spills a whole row
- A multi-row return array spills a whole column
- Reference the spill with the
#suffix - Clear blocking cells to avoid
#SPILL!
This turns a single formula into a complete record viewer.
=XLOOKUP(D2, A2:A100, B2:E100, "Not found")Quick Check
Test your understanding of spilling results from XLOOKUP.
Recap: Whole Rows and Columns
You finished the XLOOKUP course by learning to spill results:
- Widen the return array to spill a full row or column
- Spills fill empty neighboring cells and show a blue border
- Refer to a spill with the
#suffix, likeF2# - Avoid
#SPILL!by keeping the spill area clear
With syntax, fallbacks, direction, and spilling mastered, XLOOKUP can replace nearly every legacy lookup you write.
=XLOOKUP(D2, A2:A100, B2:E100, "Not found")Frequently asked questions
Is the “Returning Whole Rows or Columns” lesson free?
Yes — the full text of “Returning Whole Rows or Columns” is free to read here on the web, and the Excel Formulas Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Excel Formulas Academy course, upgrade to CoddyKit PRO.
What will I learn in “Returning Whole Rows or Columns”?
Spill multiple results from a single XLOOKUP. You practise Excel Formulas Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Excel Formulas Academy?
No prior experience is required. Excel Formulas Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Returning Whole Rows or Columns” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Excel Formulas Academy lesson?
Yes. Every Excel Formulas Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- The XLOOKUP Syntax
- Handling Misses With if_not_found
- Searching Left and From the Bottom
- Returning Whole Rows or Columns