I was demonstrating subtotals to a client today and she wanted to know how to format all the subtotal rows in bold with a different background cell colour. The workbook we were using had Counts for the subtotal.
In the example below, I have created subtotals based on a count of how many of each product have been ordered. The subtotal text is in column C.
We selected the data area including the subtotals, then went to the Home tab and in the Styles group, from the Conditional Formatting dropdown, selected New Rule. We then clicked Use a formula to determine which cells to format. The formula we typed in was =RIGHT($C1,5)=”Count”. We then clicked Format. On the font tab, we selected Bold and on the Fill tab, we selected a background colour. We then clicked OK twice. The subtotal rows were formatted accordingly.
The RIGHT function selects the rightmost xxx characters in a string, where xxx is the second argument in the function. The result looks like below:
If we had used the Average function in our subtotals, the formula in the Conditional Formatting box would have looked like =RIGHT($C1,7)=”Average”.
Find out more about our Microsoft Excel training Sydney, Australia.