简体   繁体   English

Excel - 如果特定单元格与上面的单元格不同,如何突出显示整行?

[英]Excel - How to highlight entire row if a specific cell is different from the cell above?

I am trying to apply conditional formatting in excel in which each first occurrence in a column has a highlight on the entire row.我正在尝试在 excel 中应用条件格式,其中列中的每个第一次出现都在整行上突出显示。 The desired result is as follows:期望的结果如下:

A一种 B
2 2个
2 2个
8 8个 Highlight this entire row突出显示这一整行
5 5个 Highlight this entire row突出显示这一整行
5 5个
7 7 Highlight this entire row突出显示这一整行

I currently have the formula "A3<>A2", but that highlight the last occurrence instead of the first.我目前有公式“A3<>A2”,但它突出显示了最后一次出现而不是第一次出现。 I don't know how to apply the highlight to all cells on the same row.我不知道如何将突出显示应用于同一行上的所有单元格。

UPDATE: Apparently excel behaves differently for text and numeric values.更新:显然 excel 对于文本和数值的行为不同。 My data looks like this:我的数据如下所示:

A一种 B
Apple苹果
Apple苹果
Banana香蕉 Highlight this entire row突出显示这一整行
Kiwi猕猴桃 Highlight this entire row突出显示这一整行
Kiwi猕猴桃
Apple苹果 Highlight this entire row突出显示这一整行

Conditional Formatting - Entire Row For First Occurrence in Column条件格式 - 列中首次出现的整行

  • The issue you are facing is that you have selected eg the range 2:10 (focus on 2 ) and eg you are applying the corrected ( $ ) formula =$A3<>$A2 which does what is expected: it highlights the last occurrence in a group ie if the value of the next row ( 3 ) is different than the value of the current row ( 2 ) then highlight row 2 .您面临的问题是您选择了例如范围2:10 (专注于2 )并且例如您正在应用更正的( $ )公式=$A3<>$A2它会执行预期的操作:它突出显示最后一次出现在一个组中,即如果下一行 ( 3 ) 的值与当前行 ( 2 ) 的值不同,则突出显示第2行。
  • To highlight the first occurrence in a group, you need =$A2<>$A1 as correctly posted by user11222393 since the first row you selected is row 2 ie if the value of the previous row ( 1 ) is different than the value of the current row ( 2 ) then highlight row 2 .要突出显示组中的第一次出现,您需要=$A2<>$A1user11222393正确发布,因为您选择的第一行是第2行,即如果一行 ( 1 ) 的值不同于当前行 ( 2 ) 然后突出显示行2
  • My solution will work similarly if the data is sorted.如果数据已排序,我的解决方案将以类似方式工作。 It will not highlight the first row of repeating groups though, as illustrated in the screenshot below.不过,它不会突出显示重复组的第一行,如下面的屏幕截图所示。
  • You will notice the difference between the solutions best by sorting the data in another column.通过对另一列中的数据进行排序,您将最能注意到解决方案之间的差异。 Mine should have fewer highlighted rows.我的突出显示的行应该更少。

Usage用法

  • Select the entire rows of the range and goto Home -> Conditional Formatting -> New Rule -> Use formula... (you know the drill) and eg use Select 范围内的整行,然后转到Home -> Conditional Formatting -> New Rule -> Use formula... (您知道这个技巧),例如使用

    =COUNTIF($A$2:$A2,$A2)=1

    for the first row being row 2.第一行是第 2 行。

在此处输入图像描述

=$A2<>$A1

Take a look at $ symbols.看看$符号。 If you don't use it it will highlight only 1 cell, because it will compare A2 to A1 , B2 to B1 and so on.如果您不使用它,它只会突出显示 1 个单元格,因为它会将A2A1B2B1进行比较,依此类推。

Result:结果:

在此处输入图像描述

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何根据上面的单元格突出显示excel中的单元格? - How to highlight cells in excel based on the cell above it? 给定来自超链接的单元格,如何突出显示(选择)整行 - How to highlight (select) an entire row given a cell that comes from a hyperlink 在Excel中将活动单元格的自动突出显示行应用于整个工作簿 - Applying auto-highlight row to active cell to the entire workbook in excel 在以两个特定字母开头的单元格上搜索字符串,并突出显示整行 - Search for string on cell starting with two specific letters and highlight entire row VBA excel:复制整行并根据特定单元格值多次粘贴。 然后对下面的下一行执行相同的任务 - VBA excel : Copy Entire Row and paste above multiple times based on specific cell value. Then perform same task for next rows below 当单元格具有特定单词时,突出显示excel mac 2011中的行 - Highlight the row in excel mac 2011 when a cell has a specific word Excel,单元格值更改时不同的行突出显示颜色 - Excel, different row highlight color when cell value change 如果所有单元格值都相同,则突出显示整行 - Highlight entire row if all cell values are the same Excel:如果单元格中的值与另一个选项卡上的列中的值匹配,我如何返回空白行上方的特定单元格? - Excel: If a value in a cell matches a value in a column on another tab, how can I return a specific cell above a blank row? 根据4个单元格特定的条件将整个Excel行从一个工作表复制到另一个工作表 - Copy entire Excel row from one worksheet to another based on 4 cell specific critera
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM