How to Compare Two Excel Sheets to Find Missing Data (7 Methods)

Dataset Overview

To illustrate the methods, we’ll consider two employee data lists stored in separate sheets: T-1 and T-2.

Additionally, there are two blank cells in the data table of sheet T-2, located at cells C9 and C13. Let’s explore seven distinct approaches to identify these missing values.


Method 1 – Using the IF Function

  • Create a new sheet by clicking the Plus (+) sign in the Sheet Name Bar.

Using IF Function to Compare Two Excel Sheets to Find Missing Data

  • In cell B5 of the new sheet, enter the following formula:

=IF('T-1'!B5 <> 'T-2'!B5, "T-1:"&'T-1'!B5&" vs T-2:"&'T-2'!B5, "")

  • Press Enter.

Using IF Function to Compare Two Excel Sheets to Find Missing Data

  • Drag the Fill Handle icon to the right to copy the formula up to cell C5.

  • Select the range of cells B5:C5 and drag the Fill Handle icon to copy the formula up to cell C14.

Using IF Function to Compare Two Excel Sheets to Find Missing Data

  • Observe that cells C9 and C13 display the cell value from sheet T-1 and the missing value from sheet T-2. This confirms that our formula successfully compared the two Excel sheets to find missing data.

Using IF Function to Compare Two Excel Sheets to Find Missing Data

Read More: How to Deal with Missing Data in Excel


Method 2 – Applying the VLOOKUP Function

  • Select cell D5.
  • Enter the following formula in the cell:

=VLOOKUP(B5,'T-2'!$B$4:$C$14,2,FALSE)

  • Press Enter.

Applying VLOOKUP Function to Compare Two Excel Sheets to Find Missing Data

  • Double-click the Fill Handle icon to copy the formula up to cell D14.

  • Note that the formula displays values for all cells except D9 and D13, where it shows Zero (0) for missing values.

Applying VLOOKUP Function to Compare Two Excel Sheets to Find Missing Data

Thus, our formula effectively compared the two Excel sheets to find missing data.

Interpretation of the Result

In the range of cells B5:C14, we have data from sheet T-1. We utilize the VLOOKUP function, which searches for the Case ID from sheet T-1 and retrieves the corresponding value from sheet T-2. Since cells C9 and C13 in sheet T-2 are blank, the formula returns a value of zero (0).

Read More: How to Filter Missing Data in Excel


Method 3 – Using the ISERROR and VLOOKUP Functions

  • Select cell D5.
  • In that cell, enter the following formula:

=ISERROR(VLOOKUP(C5,'T-2'!$C$4:$C$14,1,FALSE))

  • Press Enter.

Utilizing ISERROR and VLOOKUP Functions to Compare Two Excel Sheets to Find Missing Data

  • Double-click the Fill Handle icon to copy the formula up to cell D14.

  • You’ll observe that cells D9 and D13 return TRUE, while all other cells show FALSE.

Utilizing ISERROR and VLOOKUP Functions to Compare Two Excel Sheets to Find Missing Data

Interpretation of the Result

  • The data in the range of cells B5:C14 corresponds to sheet T-1.
  • The ISERROR function checks the value returned by the VLOOKUP function.
  • When the value matches, ISERROR returns FALSE.
  • If there’s a blank cell, the function returns TRUE.

Breakdown of the Formula

We are breaking down the formula for cell D9.

  • VLOOKUP(C9,’T-2′!$C$4:$C$14,1,FALSE): This function checks for an exact match of the cell value C5 in sheet T-2. Since the value isn’t available in sheet T-2 for the corresponding match, the function returns #N/A.
  • ISERROR(VLOOKUP(C9,’T-2′!$C$4:$C$14,1,FALSE)): The ISERROR function verifies whether the result of the VLOOKUP function is an error. In this case, the result isn’t an error, so it returns TRUE.

Read More: How to Find Missing Values in Excel


Method 4 – Combing the IF, ISERROR and VLOOKUP Functions

  • Select cell D5.
  • In that cell, enter the following formula:

=IF(ISERROR(VLOOKUP(C5,'T-2'!$C$4:$C$14,1,FALSE)),C5,"")

  • Press Enter.

Combing IF, ISERROR and VLOOKUP Functions to Compare Two Excel Sheets to Find Missing Data

  • Double-click the Fill Handle icon to copy the formula up to cell D14.

  • You’ll notice that cells C9 and C13 from sheet T-2 display the missing values, which correspond to the values in the corresponding cells.

Combing IF, ISERROR and VLOOKUP Functions to Compare Two Excel Sheets to Find Missing Data

Breakdown of the Formula

We are breaking down the formula for cell D9.

  • VLOOKUP(C9,’T-2′!$C$4:$C$14,1,FALSE): This function checks for an exact match of the cell value C5 in sheet T-2. Since the value isn’t available in sheet T-2 for the corresponding match, the function returns #N/A.
  • ISERROR(VLOOKUP(C9,’T-2′!$C$4:$C$14,1,FALSE)): The ISERROR function verifies whether the result of the VLOOKUP function is an error. In this case, the result isn’t an error, so it returns TRUE.
  • IF(ISERROR(VLOOKUP(C9,’T-2′!$C$4:$C$14,1,FALSE)),C9,””): The IF function checks the result of the ISERROR function. If the logic is true (i.e., there’s an error), it shows the value of C9. Otherwise, it returns blank. In this cell, the function returns the value of cell C9, which is Hagrid.

Method 5 – Using the NOT, ISNUMBER and MATCH Functions

  • Select cell D5.
  • In that cell, enter the following formula:

=NOT(ISNUMBER(MATCH(C5,'T-2'!$C$4:$C$14,0)))

  • Press Enter.

Using NOT, ISNUMBER and MATCH Functions to Compare Two Excel Sheets to Find Missing Data

  • Double-click the Fill Handle icon to copy the formula up to cell D14.

  • You’ll notice that cells D9 and D13 return TRUE, while all other cells show FALSE.

Using NOT, ISNUMBER and MATCH Functions to Compare Two Excel Sheets to Find Missing Data

Interpretation of the Result

  • The data in the range of cells B5:C14 corresponds to sheet T-1.
  • The combined formula of NOT, ISNUMBER, and MATCH functions returns FALSE when the cells of sheet T-2 contain data.
  • However, when there is a blank cell, the formula returns TRUE.

Breakdown of the Formula

We are breaking down the formula for cell D9.

  • MATCH(C9,’T-2′!$C$4:$C$14,0): This function finds the match of the value in cell C5 within the datasheet T-2. Since the value isn’t available in sheet T-2, the function returns #N/A.
  • ISNUMBER(MATCH(C9,’T-2′!$C$4:$C$14,0)): The ISNUMBER function checks whether the result of the match function is a number. For this cell, the result is not a number, so it returns FALSE.
  • NOT(ISNUMBER(MATCH(C9,’T-2′!$C$4:$C$14,0))): The NOT function toggles the result of the ISNUMBER function. In this case, the formula returns TRUE.

Read More: How to Cross Reference in Excel to Find Missing Data


Method 6 – Using the “Arrange All” Command from the View Tab

  • Open your Excel workbook.
  • Go to the View tab.
  • Click on the New Window command in the Window group. This will create a copy of your current workbook.

Applying Arrange All Command to Compare Two Excel Sheets to Find Missing Data

  • A new window with the copied workbook will appear.

Applying Arrange All Command to Compare Two Excel Sheets to Find Missing Data

  • Return to the View tab and select the Arrange All command.

Applying Arrange All Command to Compare Two Excel Sheets to Find Missing Data

  • In the Arrange Window dialog box, choose the Vertical option.
  • Click OK.

  • Now you’ll see both workbooks side by side, allowing you to manually compare the sheets and identify missing data.

Applying Arrange All Command to Compare Two Excel Sheets to Find Missing Data

Read More: How to Fill Missing Values in Excel


Method 7 – Embedding VBA Code

  1. Go to the Developer tab.
  2. Click on Visual Basic or press Alt+F11 to open the Visual Basic Editor.

Embedding VBA Code to Compare Two Excel Sheets to Find Missing Data

  • In the editor, click the Insert tab and choose Module.

  • Enter the following VBA code in the empty editor:

Sub Compare_Two_Sheets()
Dim Rng_Cell As Range
For Each Rng_Cell In Worksheets("T-1").Range("B4:C14")
    If Not Rng_Cell = Worksheets("T-2").Cells(Rng_Cell.Row, Rng_Cell.Column) Then
        Rng_Cell.Interior.Color = vbYellow
    End If
Next Rng_Cell
End Sub
  • Save the code by pressing Ctrl+S.
  • Close the editor.
  • Back in Excel, go to the Developer tab and click on Macros.

Embedding VBA Code to Compare Two Excel Sheets to Find Missing Data

  • Select Compare_Two_Sheets and click Run to execute the code.

Embedding VBA Code to Compare Two Excel Sheets to Find Missing Data

  • The cells with missing values from sheet T-2 will be highlighted in yellow.

Embedding VBA Code to Compare Two Excel Sheets to Find Missing Data


Download Practice Workbook

You can download the practice workbook from here:


Related Articles

<< Go Back To Missing Values in Excel | Data Cleaning in Excel | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Soumik Dutta
Soumik Dutta

Soumik Dutta, having earned a BSc in Naval Architecture & Engineering from Bangladesh University of Engineering and Technology, plays a key role as an Excel & VBA Content Developer at ExcelDemy. Driven by a profound passion for research and innovation, he actively immerses himself in Excel. In his role, Soumik not only skillfully addresses complex challenges but also demonstrates enthusiasm and expertise in gracefully navigating tough situations, underscoring his unwavering commitment to consistently deliver exceptional, high-quality content that... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo