Dynamic arrays
HSTACK function: join separate columns or ranges side by side
Assemble a clean lookup or summary table horizontally from separate column blocks using HSTACK.
Combine separate columns without helper links
When badge IDs sit in column A and billable hours sit in column D—or on separate tables—HSTACK(array1, [array2], ...) glues them horizontally into a single side-by-side matrix.
This is especially useful when building a custom lookup table on the fly or assembling exported report columns in a clean order.
| Badge (A) | PayGrade (B) | Team (C) | BillableHrs (D) |
|---|---|---|---|
| E-101 | G4 | Core | 38 |
| E-102 | G5 | Cloud | 42 |
| E-103 | G4 | Data | 40 |
Verify horizontal width and read assembled cells
HSTACK(A2:A4, D2:D4) builds a 3-row by 2-column array. INDEX(..., 2, 2) reads E-102 billable hours (42), and COLUMNS(HSTACK(A2:A4, C2:D4)) confirms a 3-column combined table.
=INDEX(HSTACK(A2:A4, D2:D4), 2, 2)Uneven row heights pad missing cells with #N/A
If one stacked column is shorter than another—such as HSTACK(A2:A4, D2:D3)—the missing bottom slot is padded with #N/A. For a scalar value selected with INDEX, wrap that INDEX expression in IFNA(..., 0) to replace a missing value.
=INDEX(HSTACK(A2:A4, D2:D3), 3, 2)Try the example
Use the original values or change them to test your understanding.