Stacking and reshaping lists: practice exercises
VSTACK, HSTACK, DROP, CHOOSEROWS, TOCOL, TRANSPOSE. 6 exercises on real-looking data, each marked the moment you press Check. The first exercise is below to try now; the full lesson is part of Pro.
In F2, make one list of everyone: the North team, then the South team underneath, using VSTACK. Leave out the headings.
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| 1 | North team | South team | Everyone | |||
| 2 | Nia | Will | ||||
| 3 | Pippa | Rachel | ||||
| 4 | Priya | Zoe | ||||
| 5 | Sam | Tanya | ||||
| 6 | Ella | Dev | ||||
| 7 | Chen | |||||
| 8 | ||||||
| 9 | ||||||
| 10 | ||||||
| 11 | ||||||
| 12 |
How it works
These functions take lists and tables and give you a new one, which spills. VSTACK puts lists one under another and HSTACK puts them side by side. DROP leaves out rows at the top or bottom, and CHOOSEROWS picks the rows you want.
TOCOL turns a grid into one column, and TRANSPOSE turns a table on its side.
=VSTACK(A2:B4,D2:E4) =DROP(A2:B5,-1) =CHOOSEROWS(A2:B5,1,-1) =HSTACK(A2:A4,B2:B4*2) =TOCOL(B2:F4,1) =TRANSPOSE(A1:B5)
Making new lists from old ones
Excel 365 and Excel 2024 have functions that build a new list or table from ones you already have. Like FILTER and SORT, you type them in one cell and the answer spills.
VSTACK(list1, list2): one list under the other.HSTACK(list1, list2): side by side.DROP(table, 1): everything except the first row.-1leaves out the last row instead.CHOOSEROWS(table, 1, 3): just the 1st and 3rd rows.-1is the last row.
Worked example
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Name | Hours | Name | Hours | |
| 2 | Amira | 30 | Dev | 25 | |
| 3 | Ben | 12 | Ewa | 40 | |
| 4 | Cara | 45 | Finn | 18 | |
| 5 | Total | 87 | Total | 83 |
=VSTACK(A2:B4,D2:E4)in G2. The second table goes under the first, giving six rows from Amira to Finn. The ranges stop at row 4, so the Total rows are left out.=DROP(A2:B5,-1)in G2. DROP with -1 leaves out the last row, the Total. You get Amira, Ben and Cara.=CHOOSEROWS(A2:B5,1,-1)in G2. Row 1 and the last row: Amira with 30, and the Total, 87.
One column, or on its side
TOCOL(B2:F4) reads the grid along each row in turn and puts everything in one column. Add 1 to leave out empty cells: TOCOL(B2:F4,1). Wrap it in UNIQUE to list each name once.
TRANSPOSE(A1:G2) turns a table on its side. Two rows going across become two columns going down.
What you'll practise
- In F2, make one list of everyone: the North team, then the South team underneath, using VSTACK. Leave out the headings.
- This export ends with a Total row. In E2, list every row from A2:C12 except the Total, using DROP.
- In D2, show the first and the last month (month and sales), using CHOOSEROWS. A minus number counts from the bottom.
- In F2, use HSTACK to show each name next to their half-year total (Q1 plus Q2), in one formula.
- In H2, list everyone on this week's rota once each. TOCOL with 1 turns the grid B2:F4 into one column, leaving out empty shifts. UNIQUE then takes out the repeats.
- The report needs the months going down, not across. In A5, turn the whole table A1:G2 on its side with TRANSPOSE, headings included.
Guides with worked examples: VSTACK and HSTACK: joining lists in Excel · DROP, TAKE and CHOOSEROWS: picking rows from a table · TRANSPOSE and TOCOL: turning tables round · TEXTSPLIT: splitting text into cells with a formula · #SPILL! in Excel: what it means and how to fix it