跳到主要內容

如何比較兩列並從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。 然後按 Enter 鍵以獲取第一個對應的值,然後選擇公式單元格並將填充手柄向下拖動到要應用此公式的單元格,並且所有對應的值都已立即返回,請參見屏幕截圖:


比較兩列並使用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。 然後按 Enter 鍵以獲取第一個對應的值,然後選擇公式單元格並複製到所需的其餘單元格,並且所有對應的值均已返回,請參見屏幕截圖:


如果您對Excel中的VLOOKUP函數感興趣, Excel的Kutools's 超級查找 支持一些強大的Vlookup公式, 你可以 快速執行Vlookup函數,而無需記住任何公式。 點擊下載Kutools for Excel!

Excel的Kutools:具有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 鍵在一起以獲得第一個結果,請參見屏幕截圖

然後將該數組正式複制並填充到其他單元格中,您將得到以下結果:


比較兩列,並從具有有用功能的第三列返回值

Excel的Kutools 在列表中查找值 還可以幫助您從另一個數據范圍返回相應的數據。

注意: 要應用此 在列表中查找值,首先,您應該下載 Excel的Kutools,然後快速輕鬆地應用該功能。

安裝後 Excel的Kutools,請這樣做:

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選項卡為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