Formula Errors

How to Ignore Blank Cells When Comparing Two Excel Columns

Amos GikundaAmos Gikunda Nov 10, 2026 870 views

Question details

Create an Excel formula that compares two columns for differences but ignores rows where one or both cells are blank to avoid false mismatch reports.

How to Ignore Blank Cells When Comparing Two Excel Columns
Product
Excel
Device & OS
not provided
Scenario
Comparing two data lists to identify differences while skipping incomplete records or empty cells.
Observed behavior
Standard comparison formulas flag a mismatch when one cell contains data and the adjacent comparison cell is blank, leading to false positives in the results.
Before you start

Identify the exact columns you want to compare and determine whether cells containing invisible space characters should also be treated as blank.

Solution 1Recommended

Use the IF and AND Functions to Exclude Blank Cells

This is the most direct method to ensure both comparison cells contain data before evaluating them for a mismatch.

By combining the IF and AND functions, you can instruct Excel to first verify that neither cell is empty. If both cells are populated and do not match, the formula will flag them. Otherwise, it will leave the result cell blank.

1
Select the output cell

Click on an empty cell in a new column (e.g., E2) where you want the comparison result to be displayed.

2
Enter the comparison formula

Type the formula: =IF(AND(C2<>"",D2<>"",C2<>D2),"No match",""). This assumes you are comparing data in cells C2 and D2.

3
Apply and fill down

Press Enter to execute the formula. Then, click and drag the fill handle at the bottom-right corner of the cell to apply this formula down your entire list.

Use the IF and AND Functions to Exclude Blank Cells
How this works: The condition C2<>"" checks that C2 is not blank. The AND function ensures both cells meet this criteria before proceeding to check if they are different (C2<>D2).
Seamless Data Comparison

Compare Data Easily with WPS Spreadsheet

WPS Spreadsheet fully supports advanced logical formulas like IF, AND, and TRIM, making data comparison completely seamless and accurate.

  1. 1. Open your workbook: Launch WPS Spreadsheet and open your existing file containing the columns you need to compare.
  2. 2. Apply the comparison formula: Click your target cell and type the =IF(AND(C2<>"",D2<>"",C2<>D2),"No match","") formula.
  3. 3. Fill down automatically: Double-click the bottom-right corner of the cell to instantly apply the comparison logic across all your rows.
Fully compatible with Microsoft Excel (.xlsx, .xls) files and formulas.Lightweight software that processes large datasets quickly without lag.Familiar user interface makes it easy to write, edit, and audit formulas.Free to use with a comprehensive suite of data analysis tools.
microsoft office alternative - wps office

Frequently Asked Questions

How do I highlight the mismatched cells instead of using a formula column?

You can use Conditional Formatting. Select your data columns, navigate to Home > Conditional Formatting > New Rule, choose to use a formula, and enter =AND($C2<>"", $D2<>"", $C2<>$D2). Choose a fill color and click OK. This will highlight differences only when both cells have data.

Can I output the word 'Match' when they are equal instead of leaving it blank?

Yes, you can modify the IF formula to account for matches. Use this structure: =IF(OR(C2="",D2=""),"", IF(C2=D2,"Match","No match")). This checks if either is blank first; if not, it evaluates if they match or mismatch.

Why is my formula returning an error?

Errors usually occur due to incorrect cell references or syntax typos. Ensure that your cell references (like C2 and D2) correctly point to the columns you are comparing, and double-check that you haven't missed any commas or quotation marks in the formula.