Excel for Microsoft 365 Excel for Microsoft 365 for Mac Excel for the web Excel 2021 Excel 2021 for Mac Excel 2019 Excel 2019 for Mac Excel 2016 Excel 2016 for Mac Excel 2013 Excel 2010 Excel 2007 Excel for Mac 2011 Excel Starter 2010 More…Less
To get detailed information about a function, click its name in the first column.
Note: Version markers indicate the version of Excel a function was introduced. These functions aren’t available in earlier versions. For example, a version marker of 2013 indicates that this function is available in Excel 2013 and all later versions.
Function |
Description |
DATE function |
Returns the serial number of a particular date |
DATEDIF function |
Calculates the number of days, months, or years between two dates. This function is useful in formulas where you need to calculate an age. |
DATEVALUE function |
Converts a date in the form of text to a serial number |
DAY function |
Converts a serial number to a day of the month |
DAYS function |
Returns the number of days between two dates |
DAYS360 function |
Calculates the number of days between two dates based on a 360-day year |
EDATE function |
Returns the serial number of the date that is the indicated number of months before or after the start date |
EOMONTH function |
Returns the serial number of the last day of the month before or after a specified number of months |
HOUR function |
Converts a serial number to an hour |
ISOWEEKNUM function |
Returns the number of the ISO week number of the year for a given date |
MINUTE function |
Converts a serial number to a minute |
MONTH function |
Converts a serial number to a month |
NETWORKDAYS function |
Returns the number of whole workdays between two dates |
NETWORKDAYS.INTL function |
Returns the number of whole workdays between two dates using parameters to indicate which and how many days are weekend days |
NOW function |
Returns the serial number of the current date and time |
SECOND function |
Converts a serial number to a second |
TIME function |
Returns the serial number of a particular time |
TIMEVALUE function |
Converts a time in the form of text to a serial number |
TODAY function |
Returns the serial number of today’s date |
WEEKDAY function |
Converts a serial number to a day of the week |
WEEKNUM function |
Converts a serial number to a number representing where the week falls numerically with a year |
WORKDAY function |
Returns the serial number of the date before or after a specified number of workdays |
WORKDAY.INTL function |
Returns the serial number of the date before or after a specified number of workdays using parameters to indicate which and how many days are weekend days |
YEAR function |
Converts a serial number to a year |
YEARFRAC function |
Returns the year fraction representing the number of whole days between start_date and end_date |
Important: The calculated results of formulas and some Excel worksheet functions may differ slightly between a Windows PC using x86 or x86-64 architecture and a Windows RT PC using ARM architecture. Learn more about the differences.
Need more help?
The current date and time is a very common piece of data needed in a lot of Excel solutions.
The great news is there a lot of ways to get this information into Excel.
In this post, we’re going to look at 5 ways to get either the current date or current time into our workbook.
Video Tutorial
Keyboard Shortcuts
Excel has two great keyboard shortcuts we can use to get either the date or time.
These are both quick and easy ways to enter the current date or time into our Excel workbooks.
The dates and times created will be current when they are entered, but they are static and won’t update.
Current Date Keyboard Shortcut
Pressing Ctrl + ; will enter the current date into the active cell.
This shortcut also works while in edit mode and will allow us to insert a hardcoded date into our formulas.
Current Time Keyboard Shortcut
Pressing Ctrl + Shift + ; will enter the current time into the active cell
This shortcut also works while in edit mode and will allow us to insert a hardcoded date into our formulas.
Functions
Excel has two functions that will give us the date and time.
These are volatile functions, which means any change in the Excel workbook will cause them to recalculate. We will also be able to force them to recalculate by pressing the F9 key.
This means the date and time will always update to the current date and time.
TODAY Function
= TODAY()
This is a very simple function and has no arguments.
It will return the current date based on the user’s PC settings.
This means if we include this function in a workbook and send it to someone else in a different time zone, their results could be different.
NOW Function
= NOW()
This is also a simple function with no arguments.
It will return the current date and time based on the user’s PC date and time setting.
Again, someone in a different time zone will get different results.
Power Query
In Power Query, we only have one function to get both the current date and current time. We can then use other commands to get either the date or time from the date-time.
We first need to add a new column for our date-time. Go to the Add Column tab and create a Custom Column.
= DateTime.LocalNow()
In the Custom Column dialog box.
- Give the new column a name like Current DateTime.
- Enter the DateTime.LocalNow function in the formula section.
- Press the OK button.
Extract the Date
Now that we have our date-time column, we can extract the date from it.
We can select the date-time column ➜ go to the Add Column tab ➜ select the Date command ➜ then choose Date Only.
= Table.AddColumn(#"Added Custom", "Date", each DateTime.Date([Current DateTime]), type date)
This will generate a new column containing only the current date. Power query will automatically generate the above M code with the DateTime.Date function to get only the date.
Extract the Time
We can also extract the time from our date-time column.
We can select the date-time column ➜ go to the Add Column tab ➜ select the Time command ➜ then choose Time Only.
= Table.AddColumn(#"Added Custom", "Time", each DateTime.Time([Current DateTime]), type time)
This will generate a new column containing only the current time. Power query will automatically generate the above M code with the DateTime.Time function to get only the time.
Power Pivot
With power pivot, there are two ways to get the current date or time. We can create a calculated column or a measure.
To use power pivot, we need to add our data to the data model first.
- Select the data.
- Go to the Power Pivot tab.
- Choose the Add to Data Model command.
Power Pivot Calculated Column
A calculated column will perform the calculation for each row of data in our original data set. This means we can use the calculated column as a new field for our Rows or Columns area in our pivot tables.
= TODAY()
= NOW()
It turns out Power Pivot has the exact same TODAY and NOW functions as Excel!
We can then add a new calculated column inside the power pivot add in.
- Double click on the Add Column and give the new column a name. Then select any cell in the column and enter the TODAY function and press Enter.
- Go to the Home tab ➜ Change the Data Type to Date ➜ Change the Format to any of the date formats available.
We can do the exact same to add our NOW function to get the time and then format the column with a time format.
Power Pivot Measure
Another option with power pivot is to create a measure. Measures are calculations that aggregate to a single value and can be used in the Values area of a pivot table.
Again, we can use the same TODAY and NOW functions for our measures.
Add a new measure.
- Go to the Power Pivot tab.
- Select the Measures command.
- Select New Measure.
This will open up the Measure dialog box where we can define our measure calculation.
- Give the new measure a name.
- Add the TODAY or NOW function to the formula area.
- Select a Date Category.
- Select either a date or time format option.
- Press the OK button.
Now we can add our new measure into the Values area of our pivot table.
Power Automate
If you’re adding or updating data in Excel through some automated process via Power Automate, then you might want to add a timestamp indicating when the data was added or last updated.
We can definitely add the current date or time into Excel from Power Automate.
We will need to use an expression to get either the current date or time. Power Automate expressions for the current time will result in a time in UTC which will then need to be converted into the desired timezone.
= convertFromUtc(utcNow(),'Eastern Standard Time','yyyy-MM-dd')
This expression will get the current date in the EST timezone. You can find a list of all the timezone’s here.
= convertFromUtc(utcNow(),'Eastern Standard Time','hh:mm:ss')
This expression will get the current time in the EST timezone.
Conclusions
Like most things in Excel, there are many ways to get the current date and time in Excel.
Some are static like the keyboard shortcuts. They will never update after entering them, but this may be exactly what we need.
The other methods are dynamic but need to be recalculated or refreshed.
Do you have any other methods? Let me know in the comments!
About the Author
John is a Microsoft MVP and qualified actuary with over 15 years of experience. He has worked in a variety of industries, including insurance, ad tech, and most recently Power Platform consulting. He is a keen problem solver and has a passion for using technology to make businesses more efficient.
Bottom line: With Valentine’s Day rapidly approaching I thought it would be good to explain how you can get a date with your Excel skills. Just kidding! 🙂 This post and video explain how the date calendar system works in Excel.
Skill level: Beginner
Dates in Excel can be just as complicated as your date for Valentine’s Day. We are going to stick with dates in Excel for this article because I’m not qualified to give any other type of dating advice. 🙂
Video Tutorial on How Dates Work in Excel
The following is a video from The Ultimate Lookup Formulas Course on how the date system works in Excel.
Watch the Video on YouTube
There are over 100 short videos just like the one above included in the Ultimate Lookup Formulas Course.
This course has been designed to help you master Excel’s most important functions and formulas in an easy step-by-step manner.
The Ultimate Lookup Formulas course is now part of our comprehensive Elevate Excel Training Program.
Click Here to Learn More About Elevate Excel
What is a Date in Excel?
I should first make it clear that I am referring to a date that is stored in a cell.
The dates in Excel are actually stored as numbers, and then formatted to display the date. The default date format for US dates is “m/d/yyyy” (1/27/2016).
The dates are referred to as serial numbers in Excel. You will see this in some of the date functions like DAY(), MONTH(), YEAR(), etc.
So then, what is a serial number? Well let’s start from the beginning.
The date calendar in Excel starts on January 1st, 1900. As far as Excel is concerned this day starts the beginning of time.
Each Day is a Whole Number
Each day is represented by one whole number in Excel. Type a 1 in any cell and then format it as a date. You will get 1/1/1900. The first day of the calendar system.
Type a 2 in a cell and format it as a date. You will get 1/2/1900, or January 2nd. This means that one whole day is represented by one whole number is Excel.
You can also take a cell that contains a date and format it as a number.
For example, this post was published on 1/27/2016. Put that number in a cell (the keyboard shortcut to enter today’s date is Ctrl+;), and then format it as a number or General.
You will see the number 42,396. This is the number of days that have elapsed since 1/1/1900.
Date Based Calculations
It is important to know that dates are stored as the number of days that have elapsed since the beginning of Excel’s calendar system (1/1/1900).
When you calculate the difference between two dates by subtraction, the result will be the number of days between the two dates.
1/27/2016 – 1/1/2016 = 26 days
6/30/2016 – 1/1/2016 = 181 days
There are a lot of Date functions in Excel that can help with these calculations. Last week we learned about the DAY function for month-to-date calculations with pivot tables.
We won’t go into all the date functions here, but understanding that the serial number represents one day will give you a good foundation for working with dates.
What About Dates with Times?
Do you ever work with dates that contain time values?
These dates are still stored as serial numbers in Excel. When you convert the date with a time to the number format, you will see a decimal number.
This decimal is a fraction of the day.
One hour in Excel is represented by the number: 1/24 = 0.04167
One minute in Excel is represented by the number: 1/(24*60) = 1/1440 = 0.000694
So 8:30 AM can be calculated as: (8 * (1/24)) + (30 * (1/1440)) = .354167
An easier way to calculate this is by typing 8:30 AM in a cell, then changing the format to Number.
So if you are running a half hour late and want to let your boss know, text him/her and say you will be there at 0.354167. 🙂
Checkout my article on 3 ways to group times in Excel for more date time based calculations.
Don’t Talk About Excel Dates with Your Date
Unless your Valentine shares a similar passion for Excel, I strongly recommend NOT sharing this information on your date.
I remember the first time I met my wife, and told her I worked in finance. The first word out of her mouth was, “BORING!”. Awe… it was love at first sight… LOL 🙂
But you should now be able to use Excel to determine how many days it has been since you last spoke to your date. That’s the only dating advice I can give.
Please leave a comment below with any questions on Excel dates. Thanks!
Excel spreadsheets provide the ability to work with various types of textual and numerical information. Date processing is also available. In this case, there may be a need to extract from the general meaning of a specific number, for example, a year. There are separate functions for this: YEAR, MONTH, DAY and DAY.
Examples of using functions for date processing in Excel
Excel tables store dates that are presented as a sequence of numeric values. It begins on January 1, 1900. This date will correspond to the number 1. At the same time, January 1, 2009 is laid down in the tables, as the number 39813. This is the number of days between the two designated dates.
The function YEAR is used similarly to the adjacent:
- MONTH;
- DAY;
- WEEKDAY.
All of them display numerical values corresponding to the Gregorian calendar. Even if in the Excel spreadsheet, the Hijra calendar was chosen to display the entered date, then when isolating the year and other composite values by functions, the application will present a number that is equivalent to the Gregorian system of chronology.
To use the YEAR function, you need to enter into the cell the following function formula with one argument:
=YEAR(cell address with date in numeric format)
The function argument is required. It can be replaced by «date_number_number». In the examples below, you can clearly see this. It is important to remember that when displaying the date as text (automatic orientation on the left edge of the cell), the YEAR function will not be executed. Its result will be the # SIGN. Therefore, formatted dates must be presented in a numerical version. Days, months and year can be separated by a dot, slash or comma.
Consider an example of working with the YEAR function in Excel. If we need to get a year from the original date, the function AVAILABLE will not help us since it does not work with dates, but only with text and numeric values. To separate the year, month or day from the full date for this, Excel provides functions for working with dates.
Example: There is a table with a list of dates and in each of them it is necessary to separate the value of only the year.
We introduce the original data in Excel.
To solve the problem, it is necessary to enter the formula in the cells of column B:
=YEAR(the address of the cell, from the date of which you need to isolate the year value)
As a result, we extract years from each date.
A similar example of the MONTH function in Excel:
An example of working with functions DAY and WEEKDAY. The DAY function gets to calculate from the date the number of any day:
WEEKDAY function returns the number of the day of the week (1-Monday, 2-Tuesday …, etc.) for any date:
In the second optional argument of the WEEKDAY function, the number 2 may specified for our day of the week countdown format (Monday-1 through Sunday-7):
If you omit the second optional argument, then the default format will be used (English from Sunday-1 to Saturday-7).
Create a formula of the combination of the functions INDEX and WEEKDAY:
We obtain a more understandable form of the implementation of this function.
Examples of the practical use of functions for working with dates
These primitive functions are very useful when grouping data by: years, months, days of the week, and specific days.
Suppose we have a simple sales report:
We need to quickly organize data for visual analysis without using pivot tables. To do this, we will bring the report into a table where it is convenient and quickly to group data by year, month and day of the week:
Now we have a tool to work with this sales report. We can filter and segment data by specific time criteria:
In addition, you can make a histogram to analyze the best-selling days of the week, to understand which day of the week has the largest number of sales:
In this form, it is very convenient to segment sales reports for long, medium and short periods of time.
It should be immediately noted that in order to get the difference between the two dates, none of the above functions will help us. For this task, you should use a specially designed function DATEDIF:
Download examples fo functions YEAR MONTH DAY WEEKDAY and DATEDIF
The type of values in the date cells requires a special approach to data processing. Therefore, you should use the appropriate type of function in Excel.
Sample Files
1. DATE Function
DATE function returns a valid date based on the day, month, and year you input. In simple words, you need to specify all the components of the date and it will create a date out of that.
Syntax
DATE(year,month,day)
Arguments
- year: A number to use as the year.
- month: A number to use as the month.
- day: A number to use as a day.
Example
In the below example, we have used cell references to specify the year, month, and day to create a date.
You can also insert arguments directly into the function to create a date as you can see in the below example.
And in the below example, we have used different types of arguments to see the result returned by the function.
2. DATEVALUE Function
DATEVALUE function returns a date after converting a text (which represents a date) into an actual date. In simple words, it converts a date into an actual date which is formatted as text.
Syntax
DATEVAUE(date_text)
Arguments
- date_text: The date which is stored as a text and you want to convert that text into an actual date.
Example
In the below example, we have inserted a date directly into the function by using double quotation marks. If you skip adding these quotation marks it will return a #NAME? error in the result.
In the below example, all the dates on the left side are in textual format.
- A simple textual date that we have converted into a valid date.
- A date with all three components (Year, Month, or Day) in numbers.
- If there is no year in the textual date, it will take the current year as the year.
- And if you have a month name is in alphabets and no year, it will take the current year as a year.
- If you don’t have the day in your textual date it will take 1 as the day number.
3. DAY Function
DAY function returns the day number from a valid date. As you know, in Excel, a date is a combination of day, month, and year, DAY function gets the day from the date and ignores the rest of the part.
Syntax
DAY(serial_number)
Arguments
- serial_number: A valid serial number of the date from which you want to extract the day number.
Example
In the below example, we have used the DAY to simply get the day from a date.
And in the below example, we have used DAY with TODAY to create a dynamic formula that returns the current day number and it will update every time you open your worksheet or when you recalculate your worksheet.
5. DAYS Function
DAYS function returns the difference between two dates. It takes a start date and an end date and then returns the difference between them in days. This function was introduced in Excel 2013 so not available in prior versions.
Syntax
DAYS(end_date,start_date)
Arguments
- start_date: It is a valid date from where you want to start the days’ calculation.
- end_date: It is a valid date from where you want to end the days’ calculation.
Example
In the below example, we have referred the cell A1 as the start date and B1 as the end date and we have 9 days in the result.
Note: You can also use the subtract operator to get the difference between two dates.
In the below example, we have directly inserted two dates into the function to get the difference between them.
6. EDATE Function
EDATE function returns a date after adding a specified number of months to it. In simple words, you can add (with a positive number) or subtract (with a negative number) months from a date.
Syntax
EDATE(start_date,months)
Arguments
- start_date: The date from which you want to start the calculation.
- months: The number of months to calculate the future or the past date.
Example
Here we have used EDATE with different types of arguments.
- In the first example, we have used 5 as a several months and it has added exactly 5 months on 1-Jan-2016 and returned 01-June-2016.
- In the second example, we have used -1 month and it has given 31-Dec-2016, a date which is exactly 1 month back from 31-Jan-2016.
- In the third example, we have inserted a date directly into the function.
7. EOMONTH Function
EOMONTH function returns the end of the month date which is the number of months in the future or the past. You can use a positive number for a future date and a negative number for the past month’s date.
Syntax
EOMONTH(start_date,months)
Arguments
- start_date: A valid date from where you want to start your calculation.
- months: The number of months you want to calculate before and after the start date.
Example
In the below example, we have used EOMONTH with different types of arguments:
- We have mentioned 01-Jan-2016 as the start date and 5 months for getting a future date. As June is exactly 5 months after January, it has returned 30-Jun-2016 in the result.
- As I have already mentioned, EOMMONTH is smart enough to evaluate the total number of days in a month.
- If you mention a negative number, it simply returns a past date which is the number of months back you have mentioned.
- In the fourth example, we have used a date that is in text format and it has returned the date without returning any errors.
8. MONTH Function
MONTH function returns the month number (ranging from 0 to 12) from a valid date. As you know, in Excel, a date is a combination of day, month, and year, MONTH gets the month from the date and ignores the rest of the part.
Syntax
MONTH(serial_number)
Arguments
- serial_number: A valid date from which you want to get the month number.
Example
In the below example, we have used a MONTH in three different ways:
- In the FIRST example, we have simply used date and it has returned the 5 in the result which is the month number of MAY.
- In the SECOND example, we have supplied the date directly in the function.
- In the THIRD example, we have used the TODAY function to get the current date and MONTH has returned the month number from it.
9. NETWORKDAYS Function
NETWORKDAYS function returns the count of days between the start date and end date. In simple words, with NETWORKDAYS you can calculate the difference between two dates, after excluding Saturdays and Sundays, and holidays (which you specify).
Syntax
NETWORKDAYS(start_date,end_date,holidays)
Arguments
- start_date: A valid date from where you want to start your calculation.
- end_date: A valid date up to which you want to calculate working days.
- [holidays]: A valid date that represents a holiday between the start date and end date. You can refer to a cell, range of cells, or an array containing dates.
Example
In the below example, we have specified 10-Jan-2015 as a start date and 20-Feb-2015 as an end date.
We have 41 days between these two dates, out of which 11 days are weekends. After deducting those 11 days it has returned 30 working days.
Now in the below example with the same start and end dates, we have specified a holiday and, after deducting 11 days of the weekend and 1 holiday it has returned 29 working days.
Again with the same start and end dates, we have used a range of three cells for holidays to deduct from the calculation and, after deducting 11 weekend days and 3 holidays which I have mentioned It has returned 27 working days.
10. NETWORKDAYS.INTL Function
NETWORKDAYS.INTL Function returns the count of days between the start date and end date. Unlike NETWORKDAYS, NETWORKDAYS.INTL lets you specify which days you want to exclude from the calculation.
Syntax
NETWORKDAYS.INTL(start_date,end_date,weekend,holidays)
Arguments
- start_date: A valid date from where you want to start your calculation.
- end_date: A valid date up to which you want to calculate working days.
- [weekend]: A number represents to exclude weekends from the calculation.
- [holidays]: A list of dates that represents the holidays you want to exclude from the calculation.
Example
In the below example, we have used 01-Jan-2015 as a start date and 20-Jan-2015 as an end date. And we have specified 1 to take Sunday – Saturday as the weekend. The function has returned 14 days after excluding 6 weekend days.
Below, we have used the same dates. And I have used 11 in for weekend days which means it will only consider Sunday as a weekend. Along with that, we have also used 10-Jan-2015 as a holiday.
We have 3 Sundays between both dates and a holiday. After excluding all these days the function has returned 16 days in the result. Here in the below example, we have used range to specify holidays. If you have more than one date for the holidays you can refer to an entire range.
Quick Tip: If you want to create a dynamic range for holidays, you can use a table for that. If you want to choose custom days to count as working days or weekends, you can use the below format in the weekend argument.
Here, 0 represents a working day and 1 represents a non-working day. And, seven numbers represent 7 days of the week.
11. TODAY Function
The TODAY function returns the current date and time as per the system’s date and time. The date and time returned by the NOW function update continuously whenever you update anything in the worksheet.
Syntax
TODAY()
Arguments
- In the TODAY function, there is no argument, all you need to do is enter it in the cell and hit enter, but be careful as TODAY is a volatile function which updates its value every time you update your worksheet calculations.
Example
In the below example, we have used TODAY with other functions to get the current month number, current year, and current day.
12. WEEKDAY Function
WEEKDAY function returns a day number (ranging from 0 to 7) of the week from a date. In simple words, the WEEKDAY function takes a date and returns the day number of that date’s day.
Syntax
WEEKDAY (serial_number, [return_type])
Arguments
- serial_number: A valid date from which you want to get the week number.
- [return_type]: A number that represents the day of the week to start the week.
Example
In the below example, we have used a WEEKDAY with TODAY to get a dynamic weekday. It will give you the weekday whenever the current date changes. You can use this method in your dashboards to trigger some values which need to change when weekday change.
In the below example, we have used WEEKDAY with IF to create a formula that first checks the weekday of date and return “Weekday” or “Weekend” basis on the value return from WEEKDAY.
13. WEEKNUM Function
WEEKNUM function returns the week number of a date. In simple words, WEEKNUM returns the week number of dates that you specify ranging from 1 to 54.
Syntax
WEEKNUM(serial_number,return_type)
Arguments
- serial_number: A date for which you want to get the week number.
- [return_type]: A number to specify the starting day of the first week of the year. You have two systems to specify the starting date of the week.
Example
In the below example, we have used TODAY with WEEKNUM to get the week number of the current date. It will update the week number automatically every time the date changes.
In the below example, we have added the text “Week-” with the week number for a meaningful result.
14. YEAR Function
YEAR Function returns the year number from a valid date. As you know, in Excel a date is a combination of day, month, and year, and the YEAR function gets the year from the date and ignores the rest of the part.
Syntax
YEAR(date)
Arguments
- date: A date from which you want to get the year.
Example
In the below example, we have used the year function to get the year number from the dates. You can use this function where you have dates in your data and you only need the year number.
And in the below example, we have used today function to get the year number from the current date. It will always update the year whenever you recalculate your worksheet.