Sample Data
This data shows categories of items and their amounts. We want to calculate subtotals for each category.
| Cell | Value |
|---|---|
| A1 | Category |
| B1 | Amount |
| A2 | Fruits |
| B2 | 10 |
| A3 | Fruits |
| B3 | 15 |
| A4 | Vegetables |
| B4 | 20 |
| A5 | Vegetables |
| B5 | 25 |
| A6 | Grains |
| B6 | 30 |
This data shows categories of items and their amounts. We want to calculate subtotals for each category.
| Cell | Value |
|---|---|
| A1 | Category |
| B1 | Amount |
| A2 | Fruits |
| B2 | 10 |
| A3 | Fruits |
| B3 | 15 |
| A4 | Vegetables |
| B4 | 20 |
| A5 | Vegetables |
| B5 | 25 |
| A6 | Grains |
| B6 | 30 |
=SUBTOTAL(9, B2:B6)A B 1 Category Amount 2 Fruits 10 3 Fruits 15 4 Vegetables 20 5 Vegetables 25 6 Grains 30 Formula references cells B2 to B6 for amounts.
A B 1 Category Amount 2 Fruits 10 3 Fruits 15 4 Vegetables 20 5 Vegetables 25 6 Grains 30 7 100 Cell B7 shows the subtotal sum of amounts 100.