The HSTACK function combines arrays horizontally into a single array. Each subsequent array is appended to the left of the previous array. The result from HSTACK is a single array that spills onto the worksheet into multiple cells.
HSTACK works equally well for ranges on a worksheet or in-memory arrays created by a formula. The output from HSTACK is fully dynamic. If data in any given array changes, the result from HSTACK will update immediately.
Use HSTACK to combine ranges horizontally and VSTACK to combine ranges vertically.
HSTACK stacks ranges or arrays horizontally. In the example below, the range B3:D3 is combined with the range B6:C6. Each subsequent range/array is appended to the right of the previous range/array. The formula in F3 is:
When HSTACK is used with arrays of different size, the smaller array will be expanded to match the size of the larger array. In other words, the smaller array is "padded" to match the size of the larger array, as seen in the example below. The formula in cell F5 is:
In this example, the goal is to list the 10 most frequently occurring text values in a range, in descending order by count, as seen in the range in E5:F14. This is an advanced formula that requires a number of nested...