Excel IF Formula to Replace Dates After a Reference Date
Question details
Compare dates in C10:C210 with the date in A5 and replace later dates with July 31, 2022.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A worksheet contains a reference date in A5 and a list of dates in C10:C210.
- Observed behavior
- Dates later than A5 should become July 31, 2022, while dates on or before A5 should remain unchanged.
Check that A5 and the values in C10:C210 are stored as Excel dates rather than text. Choose an empty column for the formula so it does not overwrite the source dates.
Use IF to replace dates later than A5
Compare each date with the fixed reference cell and return the replacement date only when the source date is later.
Select an empty cell beside C10, such as D10, and enter =IF(C10>$A$5,DATE(2022,7,31),C10).
Select D10 and drag its fill handle down to D210. The $A$5 reference remains fixed while each row compares its date in column C.
Select D10:D210 and choose Home > Number Format > Short Date if the results appear as serial numbers.
Copy D10:D210, select C10, and use Home > Paste > Values to replace the original dates with the results.

Replace dates after a reference date in WPS Spreadsheets
Open your workbook in WPS Spreadsheets and use the same IF formula to compare dates, fill the results down, and optionally replace the original values.
- 1. Open the workbook: Open WPS Spreadsheets and select Open to choose your Excel workbook.
- 2. Enter the formula: Select D10 or another empty cell beside C10 and enter =IF(C10>$A$5,DATE(2022,7,31),C10).
- 3. Fill and format the results: Drag the fill handle from D10 to D210, then use Home > Number Format to display the results as dates.
- 4. Save the replacement values: If you want to overwrite the original dates, copy D10:D210 and use Paste Special > Values at C10, then save the workbook.

Frequently Asked Questions
How do I also replace dates equal to A5?
Use >= instead of >: =IF(C10>=$A$5,DATE(2022,7,31),C10). Fill the revised formula down the results column.
Why does the formula use $A$5 instead of A5?
The dollar signs make A5 an absolute reference, so it stays fixed when you fill the formula down from D10 to D210.
Why do the results show numbers instead of dates?
Excel stores dates as serial numbers. Select the results and choose Home > Number Format > Short Date to display them as dates.
Can I enter the formula directly in C10?
No. A formula in C10 that refers to C10 creates a circular reference. Enter it in an empty column, then copy the results and paste them as values into column C if needed.
What if some cells in the date range are blank?
A direct reference to a blank cell can return zero. To keep blanks empty, use =IF(C10="","",IF(C10>$A$5,DATE(2022,7,31),C10)) and fill it down.




