How to Copy Values to Another Cell If Two Cells Match in Excel: 3 Methods

In this article, we will use a sample product price list as a dataset to demonstrate all the methods.

Sample Dataset for 3 Methods to Copy Values to Another Cell If Two Cells Match in Excel

 


Method 1 – Use IF Function to Copy Values to Another Cell If Two Cells Match

❶ Select cell E5.

❷ Type the formula:

=IF(B5=C5,D5,"")
within the cell.

❸ Press ENTER.

Use of IF Function to Copy Values to Another Cell If Two Cells Match

❹ Drag the Fill Handle icon to the end of the Matched Item Price column.

Fill Handle

You will see the result in the picture below:

Result of IF Function to Copy Values to Another Cell If Two Cells Match


Method 2 – Use VLOOKUP Function to Copy Values to Another Cell If Two Cells Match

❶ Select cell C15.

❷ Type the formula:

=VLOOKUP($C$14,B5:C12,2,1)
within the cell.

❸ Press ENTER.

You can see that we’ve successfully copied the price of the Noodles from the main data table.

Use VLOOKUP Function to Copy Values to Another Cell If Two Cells Match

␥  Formula Breakdown

  • $C$14 ▶ contains a lookup value, which is Noodles.
  • B5:C12 ▶ range of the whole data table.
  • 2 ▶ column index number. This means the price is copied from the second column of the main data table.
  • 1 ▶ refers to approx. match between the lookup value and the restored item.
  • =VLOOKUP($C$14,B5:C12,2,1) ▶ copies the corresponding values if two cells match another cell.

Method 3 – Use INDEX and MATCH Functions to Copy Values to Another Cell If Two Cells Match

❶ Select cell C15.

❷ Type the formula:

=INDEX(B5:C12,MATCH(C14,B5:B12,0),2)
within the cell.

❸ Press ENTER.

Using INDEX and MATCH Functions

␥  Formula Breakdown

  • MATCH(C14,B5:B12,0) ▶ searches from B5 to B12 to match the values stored in C14. C14 stores the item called Noodles, which is located in the sixth row of the data table. So, this function returns 6.
  • =INDEX(B5:C12,MATCH(C14,B5:B12,0),2) ▶ looks for the price indicated by the argument, 2. The INDEX function returns the price in the sixth row, which is 936.

Things to Remember

Be careful about the syntax of the functions.

Insert the table range carefully in formulas.


Download the Practice Workbook

You are recommended to download the Excel file and practice along with it.


<< Go Back to Excel Match | Learn Excel

 

 

Get FREE Advanced Excel Exercises with Solutions!

Tags:

Mrinmoy Roy
Mrinmoy Roy

Mrinmoy Roy, a dedicated professional with a BSc in Electronics and Communication Engineering from Khulna University of Engineering & Technology, Bangladesh, brings over two years of expertise to the ExcelDemy project. As a prolific contributor, he has authored around 180 articles, showcasing his deep knowledge and passion for Microsoft Excel, Data Analysis, and VBA. His unwavering commitment to continuous learning, combined with versatile skills, renders him well-suited for roles in data management and spreadsheet solutions. He has interest... Read Full Bio

4 Comments
  1. Don’t know if anyone reads these BUT MY MAN YOU DON’T KNOW HOW MUCH TIME YOU SAVED ME.
    Thank you so so much.

    • Dear Savvas, You are most welcome. Your encouraging words motivate us a lot. Please stay tuned with Exceldemy for amazing contents.
      Regards,
      MD Tanvir Rahman
      Excel and VBA Content Developer
      Exceldemy, Softeko

  2. Hi I’m wondering if you can please help me. If two cells match in the same column (cannot be case sensitive), is there a way to copy a few cells from the row of one of the matches to the row of the other match? Thanks so much.

    • Dear Brittany, Thank you so much for your distinctive query. Here we are setting up a sample dataset of Electronics, Fashion and Snacks category. Using the following formula containing IF function in the D5 cell, you will be able to call the value of cells of the row once it is matched to a cell of same column.
      =IF(C5=C$2,D$2,IF(C5=C$3,D$3,IF(C5=C$4,D$4,”Uncategorized”)))
      Inserting IF function formula to autofil the cells in a row
      Now drag the Fill Handle tool to fill the cells automatically.
      Using Fill Handle tool to fill the cells
      I hope, the solution will be fruitful to you. For any further shortcomings, don’t forget to reach us. Have a good day.
      Regards,
      MD Tanvir Rahman
      Excel and VBA Content Developer
      Exceldemy, Softeko

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo