Suppose that you have two adjacent columns of data. In the first column you have a list of names and in the second column a list of states. If you want to find out how many people live in each state, you can use the subtotaling features of Excel. To use this feature to answer your query, follow these steps:
- Make sure there are column heads on each column, such as “Name” and “State.” (The subtotaling feature requires the presence of column heads.)
- Sort the columns by the values in the second (states) column.
- Make sure one of the cells is still selected in either of the columns.
- Display the Data tab of the ribbon.
- In the Outline group click the Subtotal tool. Excel displays the Subtotal dialog box. (See Figure 1.)
- Make sure the At Each Change In drop-down list is set to State. (Use the name of the second column.) This indicates where Excel will insert subtotals.
- The Use Function drop-down list should be set to Count.
- Using the list in the Add Subtotal To box, choose the columns to which subtotals should be added.
- Make sure the Summary Below Data check box is selected.
- Click on OK.
Figure 1. The Subtotal dialog box.