Introduction
The Excel Days function is a Date/Time Function. It tells the number of days between a start date and the end date.
The Excel Month function returns the month from date, i.e., it returns the month number ranging from 1-12(Jan - Dec).
The Excel Year function extracts a year number from a given date, i.e., it returns the year component of a given date as a 4-digit number.
In this article, we are going to learn in detail all the three functions of excel, Days, Month, and Year Function.
Excel Days Function
Let there be a starting date A1 and an ending date E1.
=DAYS(E1, A1) will return the number of days between the two dates.
The purpose of using this function is to get the days between two dates.
The Return Value is a number representing the days.
SYNTAX -
“=DAYS(endDate, startDate)”
ARGUMENTS -
startDate(the starting date) and endDate(the ending date).
Both the start and end dates must be valid Excel dates. They can also be text values that can be parsed as dates. They should be whole numbers and not fractional values.
The Days function will return a negative value if we reverse the start and end dates.
Therefore, =DAYS(E1, A1) = E1-A1
EXAMPLES
-
=DAYS("15-Jun-21", "1-Jun-21")
//the function will return 14. -
If we want to include both the starting and ending date, increase the count by 1.
=DAYS("2-Jun-21", "1-Jun-21")+1
//this will return 2
Points to Note
- We should avoid storing or parsing dates represented by text values because it might produce errors. Thus it is better to work with native Excel dates.
- The Excel Days function works only with whole numbers.
- If the Days function can't recognize any date, it will return #VALUE! error.
- If the dates are out of range, it will return #NUM! error.