How to Fix Unexpected YEARFRAC Results Across Leap Years
Question details
The user needs to understand why the YEARFRAC function calculates leap year day counts differently than expected and how to resolve it for specific financial standards.
- Product
- Spreadsheets
- Device & OS
- not provided
- Scenario
- Calculating financial day counts between dates that cross or include a leap year using the YEARFRAC function with basis 1.
- Observed behavior
- YEARFRAC with basis 1 uses a 365-day denominator instead of a 366-day denominator for certain cross-year spans, resulting in a discrepancy compared to standard 366-day leap year calculations.
Verify the specific financial convention (e.g., Actual/Actual ISDA, Actual/365 Fixed) required for your calculations before adjusting your spreadsheet formulas.
Use a Custom Formula for Exact Leap Year Denominators
Bypass YEARFRAC limitations by manually calculating the date difference and dividing by 366 when your financial standard explicitly requires it.
Because YEARFRAC with basis 1 (Actual/Actual) uses specialized rules that may default to a 365-day denominator when crossing calendar years, it can produce results that differ from conventional financial day-count calculations. A custom formula guarantees strict adherence to your required denominator.
Select an empty cell and use the DAYS function, such as =DAYS(end_date, start_date), to find the exact number of elapsed days between your two dates.
Divide the elapsed days explicitly by 366 for leap year spans using the formula =DAYS(end_date, start_date) / 366.
To automatically adjust for leap years, wrap your calculation in an IF function that checks if the date range includes a leap year, applying /366 if true, and /365 if false.
Understand YEARFRAC Basis 1 (Actual/Actual) Rules
Learn how the YEARFRAC function natively handles days across calendar years to understand why the discrepancy occurs.
Easily Manage Financial Formulas with WPS Spreadsheet
WPS Spreadsheet fully supports advanced financial functions like YEARFRAC and allows you to build custom mathematical models for precise day-count conventions.
- 1. Open your workbook: Launch WPS Spreadsheet and open the file containing your financial data.
- 2. Select the target cell: Click on the cell where you want to display the year fraction result.
- 3. Enter the YEARFRAC formula: Type =YEARFRAC(start_date, end_date, [basis]) using references to your date cells.
- 4. Calculate the result: Press Enter to view the precise fractional year, and format the cell as a number or percentage as needed.

Frequently Asked Questions
What are the different basis options for the YEARFRAC function?
YEARFRAC supports five basis options to determine the day-count convention: 0 or omitted (US (NASD) 30/360), 1 (Actual/Actual), 2 (Actual/360), 3 (Actual/365), and 4 (European 30/360).
Why does YEARFRAC return inconsistent results around February 29?
Because the Actual/Actual rule evaluates the total days in the surrounding 12-month period based on the end date. If the period crosses into a non-leap year, the formula may use 365 instead of 366, creating counterintuitive results for dates close to February 29.
Can I force the YEARFRAC function to always use 365 days?
Yes, you can use basis 3 by entering =YEARFRAC(start_date, end_date, 3). This enforces a strict Actual/365 day-count convention regardless of whether the date span includes a leap year.




