2

I have a list of values, I have to alternate color of each row (that works fine). In that list I also have subtotals, calculated using the SUBTOTAL function.

How would I be able to give just the subtotals their own set of alternating colors?

Example (cell content / color):

row1         / white

row2         / gray

=subtotal()  / dark gray

row4         / white

row5         / gray

=subtotal()  / very dark gray

row7         / white

row8         / gray

=subtotal()  / dark gray

I know from other source how to format just the visible rows, but this still leaves out Subtotals.

How can Subtotals have their own alternating colors?

1 Answer 1

0

So I have figured it out on my own.

For those whom have similar problem here is how I did it:

I used three hidden Columns infront(left) of my table, so my data stard as column D, which serve as inputs for my conditional formating rules.

Row 2
Column A  "Is Subtotal"
Column B  "Even Subtotal"
Column C  "Even Value"
Row 3
Column A  ""
Column B  TRUE
Column C  TRUE
Row 4 
Column A  =NOT(ISERROR(FIND("Total",D4))) 
Column B  =IF(A4,NOT(B3),B3)
Column C  =IF(NOT(A4),NOT(C3),C3)

-This setup is an example of row 4 but formulas stay the same for each row

-Column A is true is that row is a Subtotal ( if you use Excel's Subtotal feature( located Data > Outline > Subtotal ), excel will include work "total" in each row containing subtotal )

-Column B if Column A determines that this is a row with subtotal then change value (true/false)

-Column C if Coulmn A derermines that this is a row without subtotal them change value (true/fale)

-lastly I have four conditioanal formating rules for each posisble scenario that use custom formula

=AND($A4,$B4)            Subtotal even
=AND($A4,NOT($B4))       Subtotal odd
=AND(NOT($A4),$B4)       Value even
=AND(NOT($A4),NOT($B4))  Value odd

I can imagine that this can be done without the extra columns but this solution keeps my formulas simpler, and more elegant I think.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .