YEARFRAC function - The function returns the fifth calculated by the number of whole days between two specific dates in Excel

YEARFRAC function: The function returns the fifth calculated by the number of whole days between two specific dates in Excel. Syntax: YEARFRAC (start_date, end_date, [basis])

The following article introduces you to the YEARFRAC function - one of the functions in the date and time group function is very popular in Excel.

YEARFRAC function - The function returns the fifth calculated by the number of whole days between two specific dates in Excel Picture 1YEARFRAC function - The function returns the fifth calculated by the number of whole days between two specific dates in Excel Picture 1

Description: The function returns the fifth as a whole number of days between two specific dates in Excel.

Syntax: YEARFRAC (start_date, end_date, [basis])

Inside:

- start_date: The start date to calculate the number of years, is a required parameter.

- end_date: The desired date to calculate the number of years, is a required parameter.

- basis: The basis for determining how to count dates, is an optional parameter including the following values:

+ basis = 0 -> Base counting days in US (NASD) 30/360.

+ basis = 1 -> Basis counting days is the actual number of days / actual year.

+ basis = 2 -> The basis of counting days is the number of actual days / 1 year 360 days.

+ basis = 3 -> Basis for counting days is the actual number of days / year with 365 days.

+ basis = 4 -> Base counting days according to EUROPEAN 30/360.

Attention:

- Excel stores the date as a serial number to facilitate the calculation process.

- All function arguments, if it is a decimal -> are truncated to integers.

- If the value of start_date, end_date is not a valid date -> the function returns the #VALUE! Error value

- If basis is outside of values ​​0 to 4 -> the function returns the #NUM! Error value

For example:

Calculate the number of years corresponding to the following time period:

YEARFRAC function - The function returns the fifth calculated by the number of whole days between two specific dates in Excel Picture 2YEARFRAC function - The function returns the fifth calculated by the number of whole days between two specific dates in Excel Picture 2

- In the cell to calculate enter the formula: = YEARFRAC (E7, F7, G7).

YEARFRAC function - The function returns the fifth calculated by the number of whole days between two specific dates in Excel Picture 3YEARFRAC function - The function returns the fifth calculated by the number of whole days between two specific dates in Excel Picture 3

- Press Enter -> the value corresponding to the above 2 dates is:

YEARFRAC function - The function returns the fifth calculated by the number of whole days between two specific dates in Excel Picture 4YEARFRAC function - The function returns the fifth calculated by the number of whole days between two specific dates in Excel Picture 4

- Similarly copying the formula for the remaining values ​​results:

YEARFRAC function - The function returns the fifth calculated by the number of whole days between two specific dates in Excel Picture 5YEARFRAC function - The function returns the fifth calculated by the number of whole days between two specific dates in Excel Picture 5

- Where the basis value is outside the scope of its values ​​-> the function returns the #NUM! Error value

YEARFRAC function - The function returns the fifth calculated by the number of whole days between two specific dates in Excel Picture 6YEARFRAC function - The function returns the fifth calculated by the number of whole days between two specific dates in Excel Picture 6

Above are instructions and some specific examples when using the YEARFRAC function in Excel.

Good luck!

4 ★ | 1 Vote