Question

I have a problem that is very similar to this one: Excel: Conditional formatting for clusters of values.

My restrictions: No helper column and only two colors should be used.

Is this possible?

Was it helpful?

Solution 2

Ok, to answer my own question:

To achieve alternating results, you can count the unique values in all the cells above including the current one.

The following formula achieves this for two alternations:

=ISODD(SUM(IF(FREQUENCY($A$1:$A1;$A$1:$A1)>0;1))) 
=ISEVEN(SUM(IF(FREQUENCY($A$1:$A1;$A$1:$A1)>0;1)))

You could use MOD and CHOOSE to allow for virtually an unlimited amount of alternatives.

The formula needs to be dragged down, the second A1 will change to A2, etc.

It is calculation intensive, so it often times takes a long time until all calculations are performed, especially if you got a long list of data.

I hope that helps.

OTHER TIPS

Assuming you have a header row the you can probably do this more easily by just counting the rows where the column A value changes from the previous, e.g. select a range starting at A2, like A2:A100 and apply this formula

=MOD(SUM(($A$1:$A1<>$A$2:$A2)+0),2)*($A2<>"")

and to highlight other rows you only need to identify populated rows, i.e.

=$A2<>""

The conditions need to be applied in that order

This will work on text values or numbers (or a mix)

change commas to semi-colons depending on regional settings

Try this one (assuming your column is B and your values start at B3). Works with text.

=ISEVEN(ROUNDDOWN(SUMPRODUCT(1/COUNTIF($B$3:B3,$B$3:B3)),0))

See result

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top