Lookup & Reference

HSTACK Function in Excel

Appends arrays horizontally (stacks columns).

Syntax

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

Arguments

  • array1 (required): First array
  • array2 (optional): Additional arrays to stack

Examples

  • =HSTACK(A1:A5, C1:C5) - Combine two columns - Result: 5x2 array

When to use HSTACK

  • Use HSTACK when you need to retrieve values from a table or range based on a key.
  • Confirm data types match (text vs number) and trim spaces before lookups.
  • Pair with [IFERROR](/functions/iferror/) or [IFNA](/functions/ifna/) for cleaner reports.
  • See the [lookup functions guide](/guides/excel-lookup-functions-guide/) for VLOOKUP, XLOOKUP, and INDEX MATCH paths.

Common HSTACK mistakes

  • #N/A often means the key is missing or exact match is wrong — see [#N/A error](/errors/na/).
  • Lock table references with $ when copying formulas down a column.
  • Compare legacy vs modern lookups in [XLOOKUP vs VLOOKUP](/compare/xlookup-vs-vlookup/).

Common errors

  • Requires Excel 365
  • Arrays should have same row count

Use cases

  • Combine columns
  • Join tables
  • Merge data

Frequently asked questions

  • What is HSTACK in Excel? HSTACK combines arrays horizontally, placing them side by side. =HSTACK(A1:A10, B1:B10, C1:C10) creates a 3-column array. It's the horizontal equivalent of VSTACK, which stacks vertically.
  • How do I add a calculated column to existing data? Use =HSTACK(A1:C10, formula_array). Example: =HSTACK(A1:C10, A1:A10*B1:B10) adds a column with row-by-row multiplication. Great for adding totals, percentages, or derived values.
  • What happens if arrays have different row counts? HSTACK pads shorter arrays with #N/A to match the tallest array. Use IFERROR to handle this: =IFERROR(HSTACK(array1, array2), ""). Or ensure arrays have matching row counts before stacking.

Editorial review

  • Reviewed by Excel.Directory Editorial Team. Updated May 2026.