Excel比较两列,找到时突出显示 [英] Excel compare two columns and highlight when found

查看:494
本文介绍了Excel比较两列,找到时突出显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



示例:



我有一个excel文件,在A列有10,000行,一些值是相同的。 pre> A1 - P7767

A2 - P3443

A3 - P7767

A4 - P8746

A5 - P9435

等...



然后我有另外一列有100行的列A中有一些值,

  B1 -  P7767 

B2 - P8746

等...



我需要突出显示列A中所有单元格,其中的值在列B中的任何值中找到



所以基本上列B检查以查看它是否可以在列A中的任何位置找到相同的值,如果true,则突出显示当列B中找不到该值时单元格为白色的单元格



我希望我已经做了很好的解释,我做了一些研究,我相信我需要使用条件格式来获得这个结果,但我真的坚持使用的公式,不能似乎在线找到一个例子(也许我没有搜索正确的术语,因为我不知道这是什么,这是完全叫做)

解决方案

可能有一个更简单的选项,但是您可以使用VLOOKUP来检查列表中是否显示值(而且VLOOKUP是一个强大的公式,无论如何都要掌握)。



因此,对于A1,您可以使用以下公式设置条件格式:

  = NOT(ISNA(VLOOKUP A1,$ B:$ B,1,FALSE))

复制并粘贴特殊>格式将条件格式复制到列A中的其他单元格。



上述公式正在做什么:




  • VLOOKUP正在查看第一列中的整列B($ B:$ B)的单元格A1(第一个参数)的值(这是第三个参数,这里冗余,但通常是VLOOKUP的外观一张桌子,而不是一列)。最后一个参数FALSE指定匹配必须是精确的,而不是最接近的匹配。

  • 如果没有匹配,VLOOKUP将返回#ISNA,所以NOT(ISNA(.. 。))对于列B中匹配的所有单元格返回true。


I have an excel file with 10,000 rows in column A some values are the same.

Example:

A1 - P7767

A2 - P3443

A3 - P7767

A4 - P8746

A5 - P9435

etc...

I then have another column with 100 rows which have some of the values found in column A,

B1 - P7767

B2 - P8746

etc...

I need to highlight all cells in column A where the value is found in any of the values in column B

So basically column B checks to see if it can find the same value anywhere in column A, if true highlight the cell leaving any cells white when the value is not found in column B

I hope I have explained this well, I have done some research and I believe I need to use conditional formatting to get this result but I am really stuck on the formula to use and cannot seem to find an example online (Maybe I am not searching the correct term as I'm not sure on what this is exactly called)

解决方案

There may be a simpler option, but you can use VLOOKUP to check if a value appears in a list (and VLOOKUP is a powerful formula to get to grips with anyway).

So for A1, you can set a conditional format using the following formula:

=NOT(ISNA(VLOOKUP(A1,$B:$B,1,FALSE)))

Copy and Paste Special > Formats to copy that conditional format to the other cells in column A.

What the above formula is doing:

  • VLOOKUP is looking up the value of Cell A1 (first parameter) against the whole of column B ($B:$B), in the first column (that's the 3rd parameter, redundant here, but typically VLOOKUP looks up a table rather than a column). The last parameter, FALSE, specifies that the match must be exact rather than just the closest match.
  • VLOOKUP will return #ISNA if no match is found, so the NOT(ISNA(...)) returns true for all cells which have a match in column B.

这篇关于Excel比较两列,找到时突出显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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