HSTACK function
Appends arrays horizontally and in sequence to return a larger array.
Lookup and reference · Excel 2024+
Where can you use it?
Reporting and operations teams. Use functions in this group to retrieve a field from an item, employee or order list, select the right record, or move values into another report.
Scenario in the workbook
Stack two ranges side by side and read the second column. Argument order controls column order.
A worked example from the workbook
| Row | A | B | C |
|---|---|---|---|
| 6 | Input | Second input | Position |
| 7 | 10 | 25 | 1 |
| 8 | 20 | 45 | 2 |
| 9 | 30 | 65 | 3 |
Record 1
=INDEX(HSTACK($A$7:$A$9,$B$7:$B$9),C7,2)Expected result25
See the inputs and instructions for all 3 examplesCopyable formulas
English Excel · en-US
=INDEX(HSTACK($A$7:$A$9,$B$7:$B$9),C7,2)Turkish Excel · tr-TR
=İNDİS(YATAYYIĞ($A$7:$A$9;$B$7:$B$9);C7;2)Worked examples
Stack two ranges side by side and read the second column. Argument order controls column order.
Open the English sheet. Inputs begin at A6. F7:F9 show the live results and G7:G9 show the original results for comparison.
| Row | A | B | C |
|---|---|---|---|
| 6 | Input | Second input | Position |
| 7 | 10 | 25 | 1 |
| 8 | 20 | 45 | 2 |
| 9 | 30 | 65 | 3 |
| Case | Formula | Expected result |
|---|---|---|
| Record 1 | =INDEX(HSTACK($A$7:$A$9,$B$7:$B$9),C7,2) |
25 |
| Record 2 | =INDEX(HSTACK($A$7:$A$9,$B$7:$B$9),C8,2) |
45 |
| Record 3 | =INDEX(HSTACK($A$7:$A$9,$B$7:$B$9),C9,2) |
65 |