Skip to content
xlsoffice. All Rights Reserved
  • Home
  • Excel For Beginners
  • Excel Intermediate
  • Advanced Excel For Experts

Lookup and Reference Examples

  • How to calculate two-way lookup VLOOKUP in Excel Table
  • Extract all partial matches in Excel
  • How to get address of first cell in range in Excel
  • Left Lookup in Excel
  • Find Closest Match in Excel Using INDEX, MATCH, ABS and MIN functions

Data Analysis Examples

  • Chart Axes in Excel
  • How to Create One and Two Variable Data Tables in Excel
  • How To Insert and Customize Sparklines in Excel
  • How To Load Analysis ToolPak in Excel
  • Data Series in Excel

Data Validation Examples

  • Data validation must not exist in list
  • Excel Data validation allow uppercase only
  • Excel Data validation date in specific year
  • Excel Data validation must begin with
  • Excel Data validation require unique number

Calculate years between dates in Excel

by

If you want to calculated the number of years between two dates,  then this tutorials is for you. See example below;

To calculated the number of years between two dates, you can use the YEARFRAC function, which will return a decimal number representing the fraction of a year between two dates. Here are a few examples of the results that YEARFRAC calculates:

Worked Example:   Excel Round a number Example

Formula

=YEARFRAC(start_date,end_date)

Explanation

Note: The YEARFRAC function has an optional 3rd argument that controls how days are counted when computing fractional years. The default behavior is to count days between two dates based on a 360-day year, where all 12 months are considered to have 30 days. The YEARFRAC page provides more information.

Worked Example:   Use of INT and TRUNC function in Excel
Start date End date YEARFRAC result
1/1/2015 1/1/2016 1
3/15/1970 9/15/1976 6.5
1/1/2000 7/15/2000 .5389
6/1/2000 6/25/1999 .9333

Once you have the decimal value, you can round the number if you like. For example, you could round to the nearest whole number:

=ROUND(YEARFRAC(A1,B1),0)

You might also want to keep only the integer portion of the result with no fractional value, so that you are only counting whole years. In that case, you can just wrap YEARFRAC in the INT function:

=INT(YEARFRAC(A1,B1))
Worked Example:   Convert inches to feet and inches in Excel

Post navigation

Previous Post:

Calculate retirement date in Excel

Next Post:

Basic timesheet formula with breaks in Excel

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Learn Basic Excel

Ribbon
Workbook
Worksheets
Format Cells
Find & Select
Sort & Filter
Templates
Print
Share
Protect
Keyboard Shortcuts

Categories

  • Charts
  • Data Analysis
  • Data Validation
  • Excel Functions
    • Cube Functions
    • Database Functions
    • Date and Time Functions
    • Engineering Functions
    • Financial Functions
    • Information Functions
    • Logical Functions
    • Lookup and Reference Functions
    • Math and Trig Functions
    • Statistical Functions
    • Text Functions
    • Web Functions
  • Excel VBA
  • Excel Video Tutorials
  • Formatting
  • Grouping
  • Others
  • DOLLAR function: Description, Usage, Syntax, Examples and Explanation
  • UNICHAR function: Description, Usage, Syntax, Examples and Explanation
  • How to calculate Number of Instances in Excel
  • Complete List of Excel Text Functions References and Examples
  • Count Number of Words in Excel
  • Generate series of dates by weekends in Excel
  • NOW function: Description, Usage, Syntax, Examples and Explanation
  • Next biweekly payday from date in Excel
  • How to calculate most recent day of week in Excel
  • Add months to date in Excel
  • RECEIVED function: Description, Usage, Syntax, Examples and Explanation
  • AMORDEGRC function: Description, Usage, Syntax, Examples and Explanation
  • Calculate loan interest in given year in Excel
  • Example of Future value of annuity in Excel
  • PRICEMAT function: Description, Usage, Syntax, Examples and Explanation
Acronyms, Abbreviations, Initialism & What They Stand For
© 2021 xlsoffice. All Rights Reserved | Teal Smiles