突出显示 Excel 中包含另一行中每个数字的行?

Highlight rows in Excel that contain every number from another row?

我有一个电子表格,其中有数千行和 6 列,每列都有一个数字。

我想做的是突出显示其中的数字与另一行的所有数字匹配的任何行。

例如:

A1: 22, B1: 19, C1: 11, D1: 17, E1: 08, F1: 01
A2: 08, B2: 17, C2: 22, D2: 01, E2: 19, F2: 11

如果我只有这些行,我希望这两行都突出显示,因为每一行中的所有数字都与另一行中的所有数字匹配。

这可以做到吗?

在我的解决方案中,我使用了一些辅助列。

单元格G2中的公式为

=SMALL($A2:$F2,COLUMN()-6)&";"

Drag it across to Column L, and then drag it down to Row 8. The logic is to sort the numbers in Column A to F form smallest to largest, and add a special symbol semicolon ; at the end of each value.

单元格M2中的公式为

=G2&H2&I2&J2&K2&L2

Drag it down to Row 8. The logic is to combine the values into one string. If you have access to TEXTJOIN function, you can use this array formula =TEXTJOIN(";",0,SMALL($A2:$F2,ROW(:))) without the need of creating the helper column G to L. As it is an array formula you need to press Ctrl+Shift+Enter upon finishing the formula in the formula bar.

单元格N2中的公式为

=COUNTIF($M:$M,M2)>1

Dray it down to Row 8. The logic is to find out if the string has appeared more than once in the range, if so returns TRUE.

最后,突出显示 A1:F8,使用以下公式设置条件格式规则并选择所需的突出显示颜色:

=$N2

如果您有任何问题,请告诉我。干杯:)

假设A列到F列的数据均为2位文本值

在A1:F1中输入:22,19,11,17,08,01

在A2:F2中输入:08,17,22,01,19,11

在helper中,G1公式复制下来:

=TEXT(SUM(LARGE(--MID(A1&B1&C1&D1&E1&F1,{1,3,5,7,9,11},2),{1;2;3;4;5;6})*{1;100;10000;1000000;100000000;10000000000}),"000000000000")

然后,select A1:G2>>条件格式>>新建规则>>选择,使用公式……>>

in the rule box enter :

=COUNTIF($G:$G,$G1)>1

Click Format >> choose cell background color

OK >> Finish