Colour all rows with the same colour until value of a cell is not the same as in the previous row anymore

扶醉桌前 提交于 2021-01-29 12:44:08

问题


I have the below Excel-table:

         |    A      |    B
---------|-----------|---------------
    1    |    500    |
    2    |    500    |
    3    |    500    |
---------|-----------|----------------
    4    |    600    |
    5    |    600    |
---------------------|----------------
    6    |    300    |
---------------------|----------------
    7    |    800    |
    8    |    800    |
    9    |    800    |
---------------------|----------------
    10   |    200    |
    11   |    200    |
---------------------|----------------
    12   |    900    |
---------------------|----------------
    13   |    100    |
    14   |    100    |
  

In Column A there a different numbers which can appear multiple times within the rows.
Now I am looking for a conditional formatting that identifies if a number has switched compared to the previous row and if so all the other rows with the same number are coloured in yellow until it switches again.
The result should look like this:

Do you have any idea what kind of conditional formatting I need to achive this?


回答1:


  • Select column A
  • Insert new conditional formatting rule based on formula and use:

If one has Excel O365:

=ISEVEN(COUNT(UNIQUE(A$1:A1)))

Older versions of Excel could use:

=ISEVEN(SUMPRODUCT(1/COUNTIF(A$1:A1,A$1:A1)))



来源:https://stackoverflow.com/questions/63843095/colour-all-rows-with-the-same-colour-until-value-of-a-cell-is-not-the-same-as-in

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!