<< Go back to all functions

HSTACK

The HSTACK function in Google Sheets is used to append ranges horizontally and in sequence to return a larger array.

Function Syntax and Parameters

Syntax: HSTACK(range1; [range2, ...])

Parameters:

  • range1: The first range to append horizontally.
  • range2, ...: [Optional] Additional ranges to append horizontally.

Step-by-Step Tutorial

  1. Using HSTACK with individual ranges:

    • Example: =HSTACK(A1:B2, C1:C2)
    • Result: [[A1,B1,C1,A2,B2,C2]]
  2. Using HSTACK with a range of cells and a single range:

    • Example: If A1:B2 has the values 1, 2, 3, 4, and C1:C2 has the values 5, 6, then =HSTACK(A1:B2, C1:C2) will return [[1, 2, 5, 3, 4, 6]].

Use Cases and Scenarios

  1. Data Integration: Combine data from different sources in a single array.
  2. Data Analysis: Merge multiple datasets horizontally for analysis.
  3. Reporting: Create a consolidated view of multiple sheets.

Related Functions

  • VSTACK: Appends ranges vertically to return a larger array.
  • ARRAYFORMULA: Applies a specified formula to a range of input, and returns the resulting array.