Excel Function

Excel HSTACK function

Combine multiple ranges side by side into one wide table — without copy-pasting columns.

HSTACK combines two or more ranges by placing them side by side horizontally. The result spills automatically to the right. Use it to build wide tables from separate narrow ranges, or to add calculated columns to a dataset without touching the original.

Syntax

HSTACK(array1, [array2], ...)
ArgumentWhat it means
array1 requiredThe first range or array.
array2, ... optionalAdditional ranges to place to the right. Up to 254 arrays.

Examples

Combine two separate columns into one table

=HSTACK(A2:A20, C2:C20)

Returns column A and column C side by side as a 2-column table — useful when your data is split across non-adjacent columns.

Add a calculated column without modifying source data

=HSTACK(A2:C20, A2:A20 * B2:B20)

Returns the original 3-column dataset with a 4th column added (column A times column B) — the source data stays untouched.

Build a report from separate summary ranges

=HSTACK( UNIQUE(A2:A100), SUMIF(A2:A100, UNIQUE(A2:A100), B2:B100), COUNTIF(A2:A100, UNIQUE(A2:A100)) )

Assembles a 3-column summary report: unique categories, total per category, count per category — all from one formula.

What happens if the arrays have different numbers of rows?
HSTACK pads the shorter array with #N/A to match the taller one. Wrap in IFERROR to suppress: =IFERROR(HSTACK(A2:A10, C2:C15), "")
What version of Excel supports HSTACK?
Excel 365 and Excel for the web. Not available in Excel 2021 or earlier.

Practice HSTACK for real

Type it in a live spreadsheet, get instant feedback. No videos, no downloads.

Start practising free →