Highlight cells in a row where the value of a particular cell is different to that of the previous row

前端 未结 2 1029
名媛妹妹
名媛妹妹 2021-01-15 00:12

I\'d like to apply some conditional formatting where each cell of a row is compared to the cell in the previous row. If it differs then the row is highlighted.

相关标签:
2条回答
  • 2021-01-15 00:38

    Yes, it is possible. It was possible in previous versions of Excel, too.

    The condition is very simple.

    Select the data, starting from the second row of data (the third row counting from the header), bring up the condition formatting dialog, select "Formula" and enter =A3<>A2, =A3<>OFFSET(A3,-1,0) where A3 is the top-left cell of the selection.
    Note the absence of dollar signs - Excel will automatically suggest them, so delete accordingly.

    Because the reference is not absolute, the formatting will properly apply to the whole table.

    0 讨论(0)
  • 2021-01-15 01:00

    You can make it even more versatile, like this:

    =INDIRECT(ADDRESS(ROW(), COLUMN()))<>INDIRECT(ADDRESS(ROW()-1, COLUMN()))
    

    Here's how it works:

    • =ADDRESS(ROW(), COLUMN()) refers to the current cell (i.e. the one to be formatted).
    • Similarly, =ADDRESS(ROW()-1, COLUMN()) refers to the cell above the current cell. Then all I do is compare the two.
    0 讨论(0)
提交回复
热议问题