In this example, we'll create a subtotal for each T-shirt size, so our worksheet has been sorted by T-shirt size from smallest to largest. If youre working with hundreds (or hundreds of thousands) of rows, then pivot tables are the best way to look at the same information in different ways. This will create an outline for our worksheet with a group for each T-shirt size and then count the total number of shirts in each group. In our example, we'll use the Subtotal command with a T-shirt order form to determine how many T-shirts were ordered in each size (Small, Medium, Large, and X-Large). In the Format Cells dialog box, uncheck the Locked box, and then click the OK button.
Select the cells in the table you need to assign new data into except the formula column, then press the Ctrl + 1 keys to open the Format Cells dialog box. Your data must be correctly sorted before using the Subtotal command, so you may want to review our lesson on Sorting Data to learn more. Press the Alt + Q keys to close the Microsoft Visual Basic for Applications window. It will create a hierarchy of groups, known as an outline, to help organize your worksheet. For example, the Subtotal command could help to calculate the cost of office supplies by type from a large inventory order.
The Subtotal command allows you to automatically create groups and use common functions like SUM, COUNT, and AVERAGE to help summarize your data.