Got any Excel/VBA Questions? Free Excel Help
One issue that is often encountered when working in Excel is that the Subtotal results, via Data>Subtotals are not bolded or made easily distinguishable. This can make the resulting data very hard to read, especially if the table that we have applied Subtotals to contains many columns. This often means the resulting subtotals are over to the right, while their associated heading are often in the first column.
Consider the small example below where Subtotals have been added to a very small table of data.
Before Subtotals
A | B | |
1 | Quarter | Cost |
2 | Quart1 | $10.00 |
3 | Quart1 | $20.00 |
4 | Quart1 | $10.00 |
5 | Quart2 | $10.00 |
6 | Quart2 | $10.00 |
7 | Quart3 | $15.00 |
9 | Quart3 | $10.00 |
10 | Quart3 | $25.00 |
After Subtotals
A | B | |
1 | Quarter | Cost |
2 | Quart1 | $10.00 |
3 | Quart1 | $20.00 |
4 | Quart1 | $10.00 |
5 | Quart1 Total | $40.00 |
6 | Quart2 | $10.00 |
7 | Quart2 | $10.00 |
8 | Quart2 Total | $20.00 |
9 | Quart3 | $15.00 |
10 | Quart3 | $10.00 |
11 | Quart3 | $25.00 |
12 | Quart2 Total | $50.00 |
13 | Grand Total | $110.00 |
In the above table our Subtotal headings have been bolded by Excel, yet their associated results have not. As this table only has two columns, it is not that hard to read and pick-out the Subtotal amounts. The more columns that a table has, the harder it becomes to visually pick-out the Subtotals.
The Solution
The solution to this problem is to make use of Excels Conditional Formatting. Using the above table as an example try this before adding your Subtotals.
The all important part to the formula is the Absolute of the Column ($A) and the Relative reference of the Row (1). As we Start ed our selection from A1, Excel will automatically change the formula for each cell. For example, cell A2 will have a Conditional Format formula of: =RIGHT($A2,5)="Total", cell B2 will also have =RIGHT($A2,5)="Total" and cell A3 and B3 will have: =RIGHT($A3,5)="Total".
Now add your Subtotals and your Subtotals will look like:
A | B | |
1 | Quarter | Cost |
2 | Quart1 | $10.00 |
3 | Quart1 | $20.00 |
4 | Quart1 | $10.00 |
5 | Quart1 Total | $40.00 |
6 | Quart2 | $10.00 |
7 | Quart2 | $10.00 |
8 | Quart2 Total | $20.00 |
9 | Quart3 | $15.00 |
10 | Quart3 | $10.00 |
11 | Quart3 | $25.00 |
12 | Quart2 Total | $50.00 |
13 | Grand Total | $110.00 |
When you remove the Subtotals, the bolded font will no longer apply.
Taking It One Step Further
The only problem with the above table now is the Grand Total is bolded the same as the Subtotals. For Grand Totals I prefer to see these formatted different again. Here is how we can do this. Again the steps are based on the above examples
Your Subtotals will now look like below
A | B | |
1 | Quarter | Cost |
2 | Quart1 | $10.00 |
3 | Quart1 | $20.00 |
4 | Quart1 | $10.00 |
5 | Quart1 Total | $40.00 |
6 | Quart2 | $10.00 |
7 | Quart2 | $10.00 |
8 | Quart2 Total | $20.00 |
9 | Quart3 | $15.00 |
10 | Quart3 | $10.00 |
11 | Quart3 | $25.00 |
12 | Quart2 Total | $50.00 |
13 | Grand Total | $110.00 |
You can of course use any format you like to make your Subtotals easier to read.
See also: Index to Excel VBA Code and Index to Excel Freebies and Lesson 1 - Excel Fundamentals and Index to how to… providing a range of solutions and Index to new resources and reference sheets
See also:
Excel Dynamic Formulas. Flexible & Changeable Formula Arguments |
Excel Dynamic Lookup Formulas |
Dynamic Named Ranges |
Excel Errors & Alerts |
Excel: Increment by Row When Copying Across Columns |
Click here to visit our Free 24/7 Excel/VBA Help Forum where there are thousands of posts you can get information from, or you can join the Forum and post your own questions.
Microsoft ® and Microsoft Excel ® are registered trademarks of Microsoft Corporation. OzGrid is in no way associated with Microsoft.