Overview for Stack

Use Stack to copy data from two or more columns into longer columns. When you use Stack, Minitab also creates a column of IDs to indicate which group each observation belongs to. You can use this ID column as a group variable in analyses and graphs.

There are three Stack commands: Stack Columns, Stack Blocks of Columns, and Stack Rows.

Stack Columns

Stack one or more columns on top of each other. For example, in the following worksheet, the data in the Seattle, Boston, and New York columns are stacked into the Sales column. For each value, the source is stored in the Subscripts column.

C1 C2 C3 C4-T C5
Seattle Boston New York Subscripts Sales
63 36 52 Seattle 63
71 32 46 Seattle 71
68 35 51 Seattle 68
66 29 50 Seattle 66
      Boston 36
      Boston 32
      Boston 35
      Boston 29
      New York 52
      New York 46
      New York 51
      New York 50

Stack Blocks of Columns

Data from several sets of columns are stacked. For example, in the following worksheet, the data in these columns are stacked:
  • Seattle and Quarter
  • Boston and Quarter
  • New York and Quarter
The Sales and Qtr columns contain the stacked columns, The source column for each sales value is stored in the Subscripts column.
C1 C2 C3 C4 C5-T C6 C7
Quarter Seattle Boston New York Subscripts Sales Qtr
1 63 36 52 Seattle 63 1
2 71 32 46 Seattle 71 2
3 68 35 51 Seattle 68 3
4 66 29 50 Seattle 66 4
        Boston 36 1
        Boston 32 2
        Boston 35 3
        Boston 29 4
        New York 52 1
        New York 46 2
        New York 51 3
        New York 50 4

Stack Rows

Stack data from a set of rows into a column. For example, in this worksheet, the data in rows across the Seattle, Boston, and New York columns are stacked into the Sales column. The Qtr column contains the row subscripts and the City column contains the column subscripts.

C1 C2 C3 C4 C5 C6 C7-T
Quarter Seattle Boston New York Sales Qtr City
1 63 36 52 63 1 Seattle
2 71 32 46 36 1 Boston
3 68 35 51 52 1 New York
4 66 29 50 71 2 Seattle
        32 2 Boston
        46 2 New York
        68 3 Seattle
        35 3 Boston
        51 3 New York
        66 4 Seattle
        29 4 Boston
        50 4 New York

Where to find these commands

To stack data, choose one of the following:
  • Data > Stack > Columns
  • Data > Stack > Blocks of Columns
  • Data > Stack > Rows

When to use an alternate command

If you want to stack corresponding columns from multiple worksheets, use Stack Worksheets.