Spreadsheet Practice

HSTACK function

HSTACK places ranges side by side to build one table, so you can pick columns that aren't next to each other, put them in a new order, or add a calculated column, all in one formula that updates with the source.

Available in
Excel 2024 and Microsoft 365
Category
Dynamic array functions
Returns
One array with the inputs side by side. Shorter inputs are padded with #N/A. It spills.

Syntax

=HSTACK(array1, [array2], ...)

ArgumentRequired?What it is
array1RequiredThe first range or array.
array2OptionalThe next range to place to the right. Add as many as you need, separated by commas.

Examples

Each result below is calculated from the sample sheet by our formula engine, the same one that grades the practice.

CellFormulaResultWhat it shows
F2=HSTACK(A2:A5,D2:D5)Ava Ruizspills 4 × 2Two columns that aren't next to each other
I2=HSTACK(C2:C5,A2:A5)ava@example.comspills 4 × 2Columns in a new order: email, then name
L2=SORT(HSTACK(A2:A5,D2:D5),2,-1)Chloe Parkspills 4 × 2The two-column table sorted by salary

Try it live

This is the sample sheet. Change any number or text, or edit a formula, and the results update.

Show the sample data as a table
NameDeptEmailSalaryName and salaryEmail firstHighest paid first
Ava RuizSalesava@example.com$68,000Ava Ruiz$68,000ava@example.comAva RuizChloe Park$82,000
Ben ColeSupportben@example.com$54,000Ben Cole$54,000ben@example.comBen ColeAva Ruiz$68,000
Chloe ParkFinancechloe@example.com$82,000Chloe Park$82,000chloe@example.comChloe ParkDev Shah$61,000
Dev ShahSalesdev@example.com$61,000Dev Shah$61,000dev@example.comDev ShahBen Cole$54,000

Practice HSTACK

Graded instantly, then re-checked on changed data.

Name and revenue

In F2, return a two-column table: each product name from A2:A6 next to its revenue, units times price (B2:B6 times C2:C6).

Common mistakes

What you seeWhy, and how to fix it
#N/A at the bottom of a columnOne range is shorter than the others. Make every range cover the same rows.
#SPILL!Something is in the cells the result needs. Clear everything below and to the right of the formula, or move it to an empty area.
#NAME?HSTACK needs Excel 2024 or Microsoft 365.

Tips

  • Add a calculated column on the fly: =HSTACK(A2:A9,B2:B9*C2:C9).
  • Feed it to FILTER to return non-adjacent columns: =FILTER(HSTACK(A2:A5,D2:D5),B2:B5="Sales").

Questions

How do I return non-adjacent columns with FILTER?

Build the source with HSTACK first: =FILTER(HSTACK(A2:A9,D2:D9),B2:B9="Sales") returns names and salaries for the Sales team.

What is the difference between HSTACK and the & operator?

& joins text into one cell. HSTACK keeps each value in its own cell and returns a table with several columns.

Last reviewed October 2026. Every example result on this page is calculated live by the Spreadsheet Practice formula engine.