0

I would like to "walk" through a Excel column and if the the preceding or following cell has the same value, mark it with a color.

For example:

Column A:
1        <~~~~ highlight
1        <~~~~ highlight
1        <~~~~ highlight
2
1
3        <~~~~ highlight
3        <~~~~ highlight
  • The first tree 1's would be colored;
  • the 2 not, not the next 1 either; and
  • the last 3's again colored.

I know this should be done in conditional formatting. But how?

Jean-François Corbett
  • 37,420
  • 30
  • 139
  • 188
digit
  • 1,513
  • 5
  • 29
  • 49

1 Answers1

2

Conditional formatting using a formula

=OR(A2=A1,A2=A3)

Note that a dummy row is needed at the top of your list and another one at the bottom to deal with the edge cases if you want to use the same formula throughout. Alternatively, use different formulas for the top (=A2=A3) and bottom (=A8=A7) items.

enter image description here

Jean-François Corbett
  • 37,420
  • 30
  • 139
  • 188