How To Use Yearfrac Function In Excel | How to get difference in year between specific date in Excel

preview_player
Показать описание
Excel YEARFRAC Function

The Excel YEARFRAC function returns a decimal value that represents fractional years
between two dates.
You can use YEARFRAC to do things like calculate age with a birthdate.

the Purpose of this function is to Get the fraction of a year between two dates
which will Return the value that is A decimal number

Syntax
=YEARFRAC (start_date, end_date, [basis])
Arguments
start_date - The start date.
end_date - The end date.
basis - [optional] The type of day count basis to use (see below).

=YEARFRAC("1-Jan-2018","1-Jan-2019") // returns 1
=YEARFRAC("1-Jan-2018","1-Jul-2019") // returns 1.5
The YEARFRAC function has an optional argument called "basis" 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 table below summarizes available options:

Basis Calculation Notes
0 (default) 30/360 US convention
1 actual/actual
2 actual/360
3 actual/365
4 30/360 European convention
Examples

=YEARFRAC(A1,B1) // years between two dates
To get a whole number only (not rounded), you can use the INT function like this:

=INT(YEARFRAC(A1,B1)) // whole number only, discard decimal
To get current age based on a birthdate, you can use a formula like this:

=INT(YEARFRAC(birthdate,TODAY())) // age from birthdate
Note: this formula can sometimes return incorrect results. See this example for more details.

To get the percentage of the current year complete, you can use YEARFRAC like this:

=YEARFRAC(DATE(YEAR(TODAY()),1,1),TODAY()) // % year complete

You can follow us on the below social media handles:-
Рекомендации по теме