Formula Errors

Excel IF Formula to Copy Cell C to Cell A When B Equals D

Chanuka GeekiyanageChanuka Geekiyanage Nov 22, 2026 868 views

Question details

Use an IF formula to return the value from column C in column A only when the values in columns B and D match.

Copy Cell C to Cell A When B Equals D in Excel
Product
Microsoft Excel
Device & OS
not provided
Scenario
A worksheet needs to compare two cells in each row and conditionally display a value from a third cell.
Observed behavior
Column A should display the corresponding value from column C when columns B and D match; otherwise, it should appear blank.
Before you start

Identify the first row of your data and make sure the destination cell in column A is available for a formula. The example below assumes the data starts in row 2.

Solution 1Recommended

Use an IF Formula to Return the Matching Row's Value

Use this formula when A2 should show C2 only if B2 and D2 contain matching values.

1
Select the destination cell

Open the worksheet in Excel and select cell A2.

2
Enter the IF formula

Type =IF(B2=D2,C2,"") in A2 and press Enter.

3
Apply it to other rows

Drag the fill handle at the bottom-right corner of A2 down column A to apply the formula to additional rows.

Use an IF Formula to Return the Matching Row's Value
How the formula behaves: When B2 and D2 differ, the formula returns an empty string, so A2 appears blank but still contains a formula. If both comparison cells are blank, Excel treats them as equal.
Use WPS Spreadsheets

Compare Cells and Return a Value in WPS Spreadsheets

Use the same IF formula in WPS Spreadsheets to display a value from column C when the values in columns B and D match.

  1. 1. Open the workbook: Open WPS Spreadsheets and use Open to select your workbook.
  2. 2. Select A2: Click cell A2, or select the destination cell in the first row of your data.
  3. 3. Enter the formula: Type =IF(B2=D2,C2,"") and press Enter. Adjust the row numbers if your data starts on a different row.
  4. 4. Fill down: Drag the fill handle from A2 down column A to apply the formula to the remaining rows.
Compare cells and conditionally return values with the IF functionOpen and edit Microsoft Excel XLSX and XLS filesFill the formula down multiple rows with the fill handle
microsoft office alternative - wps office

Frequently Asked Questions

What does the formula show when B2 and D2 do not match?

The formula =IF(B2=D2,C2,"") returns an empty string, so A2 appears blank while retaining the formula.

Will the formula update if C2 changes?

Yes. When B2 and D2 match, A2 displays the current value of C2. To keep a fixed result instead, copy A2 and use Paste Special > Values.

What happens if B2 and D2 are both blank?

Excel treats the two blank cells as equal, so the formula returns C2. To require B2 to be nonblank, use =IF(AND(B2<>"",B2=D2),C2,"").

How do I use the formula for a different starting row?

Change all row references to your starting row. For example, enter =IF(B3=D3,C3,"") in A3 if your data starts on row 3.