如果列中的相邻单元格具有相同的值,则突出显示该单元格 [英] Highlight cell if an adjacent cell in column has the same value

查看:198
本文介绍了如果列中的相邻单元格具有相同的值,则突出显示该单元格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想遍历" Excel列,并且如果前一个或后一个单元格具有相同的值,请用颜色标记它.

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.

例如:

Column A:
1        <~~~~ highlight
1        <~~~~ highlight
1        <~~~~ highlight
2
1
3        <~~~~ highlight
3        <~~~~ highlight

  • 第一棵树1将被着色;
  • 不是2,也不是接下来的1;和
  • 最后3个再次着色.
  • 我知道这应该以条件格式完成.但是如何?

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

    推荐答案

    使用公式进行条件格式化

    Conditional formatting using a formula

    =OR(A2=A1,A2=A3)
    

    请注意,如果要始终使用相同的公式,则在列表的顶部需要一个虚拟行,在底部需要一个虚拟行来处理边缘情况.或者,对顶部(=A2=A3)和底部(=A8=A7)项目使用不同的公式.

    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.

    这篇关于如果列中的相邻单元格具有相同的值,则突出显示该单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆