Function Reference: HSTACK, VSTACK
| Syntax | ||
| =HSTACK(array1,[array2],...[array254]) =VSTACK(array1,[array2],...[array254]) |
||
| Purpose / Description | ||
| Returns an array in which the contents of one or more arrays are stacked side-by-side (HSTACK) or one above the other (VSTACK). | ||
| Arguments | ||
| Name | Type | Description |
| array1 | reference or array of any | A reference or nested expression that returns a valid reference, a constant array of any values or a nested expression that returns an array of any values. |
| [array2], ...[array254] |
reference or array of any | A further optional up to 253 extra references to ranges, constant arrays of any values or nested expressions that return arrays of any values. |
| Return Values | ||
| Type | Specific Value | Description |
| array of any | Regardless of whether the original array is a reference to a range, a calculated array, or a constant array, the result returned is an array containing the values from the provided arrays, stacked either horizontally for HSTACK or vertically for VSTACK. | |
| error | #N/A | For HSTACK, if any of the arrays has fewer rows of values than the array with the most rows, the extra rows for that array are filled with #N/A. For VSTACK, if any of the arrays has fewer columns than the array with the most columns, the extra columns for that array are filled with #N/A. |
| error | Any errors referenced by arguments are returned due to propagation of error values. | |
| Notes / Comments / Advice / Warnings | ||
| Comment: | This are extremely useful additions to Excel, allowing for the construction of output ranges in reports and dashboards, and in modelling ranges, where the results can be derived by a number of stacked calculations. Especially column-by-column and row-by-row totaling. They are extremely useful in LET expressions where several steps of calculation need to be summarised to a single table of results. |
|
| Comment: | Use IFNA function to wrap an HSTACK or VSTACK where different sized arrays are stacked, to replace the #N/A values with a more acceptable value, such as 0 or an empty string(""). | |
| Examples: | Open / download sample workbook: HSTACK, VSTACK.xlsx | |