Use an Excel IF Formula with a Date Condition
Question details
Create a formula that returns zero for dates on or after March 31, 2023, and 5% of G15 for earlier dates.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A worksheet needs to calculate a result based on the date in B3 and the value in G15.
- Observed behavior
- The desired result is zero when B3 is March 31, 2023, or later; otherwise, it is G15 multiplied by 5%.
Check that B3 contains a valid spreadsheet date and G15 contains a numeric value. Choose an empty cell for the result so the formula does not replace either input.
Compare the Date with IF and DATE in Excel
Use this formula to include March 31, 2023, in the zero-result condition.
DATE(2023,3,31) creates a valid date for comparison. Writing 2023-3-31 directly in a formula would perform subtraction instead.
In Excel, click the empty cell where you want the calculated result to appear.
Type =IF(B3>=DATE(2023,3,31),0,G15*0.05) in the cell or formula bar, then press Enter.
Enter or select a date in B3 and a numeric value in G15. Dates on or after March 31, 2023, return 0; earlier dates return 5% of G15.

Apply the Same Date Condition in WPS Spreadsheets
Use the IF and DATE functions in WPS Spreadsheets to calculate the same result in an Excel-compatible workbook.
- 1. Open the workbook: Open WPS Spreadsheets and use Open to select your workbook.
- 2. Check the inputs: Confirm that B3 contains a valid date and G15 contains a number.
- 3. Enter the formula: Click an empty result cell, type =IF(B3>=DATE(2023,3,31),0,G15*0.05), and press Enter.
- 4. Save the workbook: Use File > Save or Save As to save your changes, including in XLSX format if needed.

Frequently Asked Questions
Does the formula return zero on March 31, 2023?
Yes. The >= operator includes March 31, 2023, as well as all later dates.
Why use DATE(2023,3,31) instead of 2023-3-31?
DATE(2023,3,31) creates a date value. Excel interprets 2023-3-31 as a subtraction calculation.
What happens if B3 is blank?
A blank B3 may be treated as zero in the comparison, causing the formula to return 5% of G15. Enter a valid date in B3 before using the result.
What if Excel does not accept commas in the formula?
Some regional settings use semicolons as argument separators. Try =IF(B3>=DATE(2023;3;31);0;G15*0.05) instead.




