Function Problems

How to Calculate Days Between Dates While Ignoring Leap Days in WPS Spreadsheets

Elise WilliamsElise Williams Nov 13, 2026 869 views

Question details

The user needs to calculate the number of days between two dates in WPS Spreadsheets while excluding February 29 when the date range crosses a leap day.

Product
WPS Spreadsheets
Device & OS
not provided
Scenario
The user is working with a worksheet that tracks elapsed days and wants to ignore leap days in the date-range count.
Observed behavior
The goal is a day-count result that excludes February 29 when the selected date range crosses it.
Before you start

Verify that your start date and end date are stored as real date values in WPS Spreadsheets. The example assumes the start date is in cell A2 and the end date is in cell B2; adjust these references to match your worksheet.

Solution 1Recommended

Use DATEDIF with an IF adjustment to exclude February 29

Use this formula when your date range crosses February 29 and you want the total day count to ignore that leap day.

The DATEDIF function calculates the total number of days between two date cells. The IF part checks whether the start date falls on or before February and the end date falls on or after March in the same year. When that condition is true, one day is subtracted from the total so February 29 is not counted.

1
Select the result cell

Open your workbook in WPS Spreadsheets and click the empty cell where you want the day count to appear.

2
Enter the formula

Type =DATEDIF(A2,B2,"d")-IF(AND(MONTH(A2)<=2,MONTH(B2)>=3,YEAR(A2)=YEAR(B2)),1,0) into the formula bar and press Enter.

3
Confirm the adjusted result

The cell now shows the total days between the two dates with February 29 excluded when the range crosses that leap day.

Date references adjusted: Replace A2 and B2 with your actual start-date and end-date cells before pressing Enter.
WPS Spreadsheets

Calculate Day Counts in WPS Spreadsheets Without Leap Day Interference

Use WPS Spreadsheets to open your workbook, enter the DATEDIF and IF formula, and get a day count that excludes February 29 when it falls inside the date range.

  1. 1. Open the workbook in WPS Spreadsheets: Launch WPS Office, open the spreadsheet that contains the date cells, and locate the start-date and end-date columns.
  2. 2. Select the result cell: Click the empty cell where you want the adjusted day count to appear.
  3. 3. Enter the leap-day-adjusted formula: Type =DATEDIF(A2,B2,"d")-IF(AND(MONTH(A2)<=2,MONTH(B2)>=3,YEAR(A2)=YEAR(B2)),1,0) into the formula bar and press Enter.
  4. 4. Check and adjust cell references: If your dates are not in A2 and B2, replace those references with the correct cells and verify that the result excludes February 29 when the range crosses it.
Excludes February 29 from same-year date-range calculationsUses standard DATEDIF and IF functions familiar to Excel usersOpens and saves Microsoft Excel .xlsx files with full compatibilityFree to use in WPS Office with a familiar spreadsheet interface
microsoft office alternative - wps office

Frequently Asked Questions

Why does the formula subtract one day instead of using a different DATEDIF unit?

DATEDIF with "d" counts every calendar day between the two date cells, including February 29 in a leap year. The IF adjustment subtracts one day when the range crosses that date.

How do I adjust the formula if my dates are not in A2 and B2?

Replace A2 with the cell containing the earlier date and B2 with the cell containing the later date, then press Enter.

Does this formula work for date ranges that span more than one year?

The provided formula is designed for a same-year range crossing February 29. For a range spanning multiple years, subtract one day for each February 29 that occurs inside the range.

What should I do if the result cell shows a date instead of a number?

Select the result cell, open the cell format settings, and set the format to General or Number so the day count displays as a number.