跳到主要内容

如何比较两列并从Excel中的第三列返回值?

例如,我有以下两列,A列是一些项目,B列是相应的名称。 在这里,我在D列中有一些随机项目,现在,我想根据D列中的项目从B列中返回相应的名称。如何比较两个A列和D列并从B列中返回相对值在Excel中?


比较两列并使用VLOOKUP函数从第三列返回值

VLOOKUP函数可以帮助您比较两列并从第三列中提取相应的值,请执行以下操作:

1。 将以下两个公式中的任何一个输入到除了已比较列E2之外的空白单元格中:

=VLOOKUP(D2,$A$2:$B$16,2,FALSE)   (if the value not found, an #N/A error is displayed)
= IFERROR(VLOOKUP(D2,$ A $ 2:$ B $ 16,2,FALSE),“”)    (如果找不到该值,则显示一个空单元格)

请注意: 在以上公式中: D2 是您要基于其返回值的条件单元格, A2:A16 是包含要比较的条件的列, A2:B16 您要使用的数据范围。

2。 然后按 输入 键以获取第一个对应的值,然后选择公式单元格并将填充手柄向下拖动到要应用此公式的单元格,并且所有对应的值都已立即返回,请参见屏幕截图:


比较两列,并使用INDEX和MATCH函数从第三列返回值

在Excel中,INDEX和MATCH函数也可以帮助您解决此任务,请执行以下操作:

1。 在要返回结果的空白单元格中输入以下两个公式之一:

=INDEX($B$2:$B$16, MATCH(D2,$A$2:$A$16,0))    (if the value not found, an #N/A error is displayed)
=IFERROR(INDEX($B$2:$B$16, MATCH(D2,$A$2:$A$16,0)), "")    (如果找不到该值,则显示一个空单元格)

请注意: 在以上公式中: D2 是您要返回其相对信息的值, A2:A16 是包含您要返回的值的列表, B2:B16 是您要查找的列。

2。 然后按 输入 键以获取第一个对应的值,然后选择公式单元格并复制到所需的其余单元格,并且所有对应的值均已返回,请参见屏幕截图:


如果您对Excel中的VLOOKUP函数感兴趣, Kutools for Excel's 超级查找 支持一些强大的Vlookup公式, 您可以 快速执行Vlookup函数,而无需记住任何公式。 点击下载Kutools for Excel!

Kutools for Excel:具有300多个方便的Excel加载项,可以在30天内免费试用,没有任何限制。 立即下载并免费试用!


Vlookup多列并使用INDEX和MATCH函数返回相应的值

有时,您可能有一个包含三列的数据范围,现在您想在表上查找以匹配两个条件值,如果两个值都匹配,它将从第三列C返回数据。

第三列的doc返回值

要完成这项工作,请使用以下公式:

=INDEX($C$2:$C$16,MATCH(E2&F2, $A$2:$A$16&$B$2:$B$16,0))

请注意: 在以上公式中: E2, F2 是您要基于其返回值的条件单元格, C2:C16 是包含您要返回的值的列, A2:A16, B2:B16 是您要查找的列。

然后按 Ctrl + Shift + Enter 键在一起以获得第一个结果,请参见屏幕截图

然后将该数组正式复制并填充到其他单元格中,您将得到以下结果:


比较两列,并从具有有用功能的第三列返回值

Kutools for Excel 在列表中查找值 还可以帮助您从另一个数据范围返回相应的数据。

请注意: 申请这个 在列表中查找值,首先,您应该下载 Kutools for Excel,然后快速轻松地应用该功能。

安装后 Kutools for Excel,请这样做:

1。 单击要放入匹配结果的单元格。

2。 然后点击 库工具 > 公式助手 > 公式助手,请参见屏幕截图:

3。 在 公式助手 对话框,请执行以下操作:

  • 公式类型 下拉列表,请选择 查找 选项;
  • 然后,选择 在列表中查找值 在选项 选择一个公式 列表框;
  • 然后,在 参数输入 文本框,分别选择要返回匹配值的数据范围,条件单元格和列。

4。 然后点击 Ok,并且已返回基于特定值的第一个匹配数据。 您只需要拖动填充手柄即可将此公式应用于所需的其他单元格,请参见屏幕截图:

立即下载和免费试用Excel的Kutools!


更多有关VLOOKUP的文章:

  • Vlookup并连接多个对应值
  • 众所周知,Excel中的Vlookup函数可以帮助我们查找值并在另一列中返回相应的数据,但是通常,只有在存在多个匹配数据时,它才能获取第一个相对值。 在本文中,我将讨论如何仅在一个单元格或垂直列表中进行vlookup并串联多个对应的值。
  • Vlookup并返回最后一个匹配值
  • 如果您有一个列表,这些列表可以重复很多次,而现在,您只想知道指定数据的最后一个匹配值。 例如,我具有以下数据范围,A列中有重复的产品名称,但C列中有不同的名称,并且我想返回产品Apple的最后一个匹配项Cheryl。
  • 跨多个工作表的Vlookup值
  • 在excel中,我们可以轻松地应用vlookup函数在工作表的单个表中返回匹配值。 但是,您是否曾经考虑过如何在多个工作表中实现vlookup价值? 假设我有以下三个具有数据范围的工作表,现在,我想根据这三个工作表中的条件来获取相应值的一部分。
  • Vlookup并垂直返回多个值
  • 通常,您可以使用Vlookup函数来获取第一个对应的值,但是有时您希望基于特定条件返回所有匹配的记录。 本文,我将讨论如何进行vlookup并将所有匹配值垂直,水平或返回到单个单元格中。

最佳办公生产力工具

🤖 Kutools 人工智能助手:基于以下内容彻底改变数据分析: 智能执行   |  生成代码  |  创建自定义公式  |  分析数据并生成图表  |  调用 Kutools 函数...
热门特色: 查找、突出显示或识别重复项   |  删除空白行   |  合并列或单元格而不丢失数据   |   不使用公式进行四舍五入 ...
超级查询: 多条件VLookup    多值VLookup  |   跨多个工作表的 VLookup   |   模糊查询 ....
高级下拉列表: 快速创建下拉列表   |  依赖下拉列表   |  多选下拉列表 ....
列管理器: 添加特定数量的列  |  移动列  |  切换隐藏列的可见性状态  |  比较范围和列 ...
特色功能: 网格焦点   |  设计图   |   大方程式酒吧    工作簿和工作表管理器   |  资源库 (自动文本)   |  日期选择器   |  合并工作表   |  加密/解密单元格    按列表发送电子邮件   |  超级筛选   |   特殊过滤器 (过滤粗体/斜体/删除线...)...
前 15 个工具集12 文本 工具 (添加文本, 删除字符,...)   |   50+ 图表 类型 (甘特图,...)   |   40+ 实用 公式 (根据生日计算年龄,...)   |   19 插入 工具 (插入二维码, 从路径插入图片,...)   |   12 转化 工具 (小写金额转大写, 货币兑换,...)   |   7 合并与拆分 工具 (高级组合行, 分裂细胞,...)   |   ... 和更多

使用 Kutools for Excel 增强您的 Excel 技能,体验前所未有的效率。 Kutools for Excel 提供了 300 多种高级功能来提高生产力并节省时间。  单击此处获取您最需要的功能...

产品描述


Office Tab 为 Office 带来选项卡式界面,让您的工作更加轻松

  • 在Word,Excel,PowerPoint中启用选项卡式编辑和阅读,发布者,Access,Visio和Project。
  • 在同一窗口的新选项卡中而不是在新窗口中打开并创建多个文档。
  • 每天将您的工作效率提高50%,并减少数百次鼠标单击!
Comments (36)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
I have 3 column table

COL_A, COL_B, COL_C
10 Yes 10
10 No. -

If column a value 10 and column b is Yes then Col c need col_a value, if Col_B no then column C need "-"

Please suggest formula
This comment was minimized by the moderator on the site
Name score points
1 25
2 13
3 7
4 12
5 1
6 19
7 63
8 18
9 54
10 12
11 22
12 5
13 9


How do i compare the values in the Score column and assign a point value based on highest to lowest and ties (13 to 1, and the Two 12s get the same value)

Thanks in advance.
This comment was minimized by the moderator on the site
I want to derive a value from a third column regardless of the order that is presented. So here you have BB-112 : Sarah : Completed. I want it to say Completed even if the values are reversed, ie Sarah : BB-112 : Completed. How can I make the order irrelevant?
This comment was minimized by the moderator on the site
Hello Jotari,Glad to help. Actually the easist way to achieve your goal is by using the new XLOOKUP function. For example, to know the country and abr of the country acchording to the Telephone Code, we can use the formula =XLOOKUP(F2,$C$2:$C$11,$A$2:$B$11), and the country and abr of the country regardless of the order of the values. Please see the screenshou I uploaded here. And please notice that the XLOOKUP is only available in Excel 2020, Excel for web and Microsoft 365.Sincerely,Mandy
This comment was minimized by the moderator on the site
I'm using GoogleSheets, it doesn't seem to have the XLOOKUP function.
This comment was minimized by the moderator on the site
HI Team, I would like to Compare column A and Column B if we found a value in column A , then print the result in Column C, else check in column B if found the value in Column B, then print in Column C , if we didn't found any value in columns A or B, then print the result in Column C as no value found using MS Excel
Compare Columns A and B  value found both the columns A and B then, Print the Column Value A in Column C
Compare Columns A and B Value found in A  then pint the Column Value A in   Column CCompare Columns A and B Value not found in A and Value found in Column B then print the column value in Column CCompare columns A and B value not found in both the columns A and B, then print the columns C with No value found 
This comment was minimized by the moderator on the site
=INDEX($C$2:$C$16,MATCH(E2&F2, $A$2:$A$16&$B$2:$B$16,0)) is not working
This comment was minimized by the moderator on the site
I have data range, wherein I have date, Machine no & Site(under site I have mentioned where is the machine currently and if any repair has been done). So, what I need now is the last date of repair of that machine no. Can you please help?
This comment was minimized by the moderator on the site
I think the first VLOOKUP example has an error in it. The first value should be D2, not D3. This could be why some people are having problems. Just thought I should point that out. Excellent work, though, thanks!
This comment was minimized by the moderator on the site
Hello, Jason,Thank you for your comment, yes, as you said, the cell reference should D2, not D3, I have updated the formula.Thanks again!
This comment was minimized by the moderator on the site
what if i have repeated valued in d column i.e with same name Q!,Q2,Q3,Q4 now if i use your formula i get only Q1 value i need also the 2nd,3rd,4th,matches also
This comment was minimized by the moderator on the site
I want to compare 2 columns data on one sheet to a range on another sheet and return the data in the 3rd column from the 2nd sheet
This comment was minimized by the moderator on the site
I have 3 columns, A B C, i'd like to get the value of A where the value in Column C matches the value in column B is that possible?
This comment was minimized by the moderator on the site
Hi, .
Could you explain your problem more detailed, or you can insert a screenshot here?
Thank you!
This comment was minimized by the moderator on the site
i'm facing the same issue,can u provide any formula for this type of calculation,i want result in another column.
This comment was minimized by the moderator on the site
Hi, guys,
Could you give your problem more detailed, or, you can insert a screenshot here?
This comment was minimized by the moderator on the site
Can u help me plz, i'm facing the same issue?
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations