Function Problems

Use an Excel IF Formula with a Date Condition

Bushra ParveenBushra Parveen Dec 2, 2026 868 views

Question details

Create a formula that returns zero for dates on or after March 31, 2023, and 5% of G15 for earlier dates.

Use an Excel IF Formula with a Date Condition
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%.
Before you start

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.

Solution 1Recommended

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.

1
Select the result cell

In Excel, click the empty cell where you want the calculated result to appear.

2
Enter the formula

Type =IF(B3>=DATE(2023,3,31),0,G15*0.05) in the cell or formula bar, then press Enter.

3
Check the result

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.

Compare the Date with IF and DATE in Excel
Check date values: If B3 contains a date stored as text, convert it to a valid date before relying on the comparison. A blank B3 may also produce an unintended result.
Calculate dates in WPS Spreadsheets

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. 1. Open the workbook: Open WPS Spreadsheets and use Open to select your workbook.
  2. 2. Check the inputs: Confirm that B3 contains a valid date and G15 contains a number.
  3. 3. Enter the formula: Click an empty result cell, type =IF(B3>=DATE(2023,3,31),0,G15*0.05), and press Enter.
  4. 4. Save the workbook: Use File > Save or Save As to save your changes, including in XLSX format if needed.
Compare dates with familiar IF and DATE functionsOpen and edit Microsoft Excel XLSX filesUse a familiar spreadsheet interfaceGet a free, lightweight office suite
microsoft office alternative - wps office

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.