2016 dates in excel

Format numbers as dates or times

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 More…Less

When you type a date or time in a cell, it appears in a default date and time format. This default format is based on the regional date and time settings that are specified in Control Panel, and changes when you adjust those settings in Control Panel. You can display numbers in several other date and time formats, most of which are not affected by Control Panel settings.

In this article

  • Display numbers as dates or times

  • Create a custom date or time format

  • Tips for displaying dates or times

Display numbers as dates or times

You can format dates and times as you type. For example, if you type 2/2 in a cell, Excel automatically interprets this as a date and displays 2-Feb in the cell. If this isn’t what you want—for example, if you would rather show February 2, 2009 or 2/2/09 in the cell—you can choose a different date format in the Format Cells dialog box, as explained in the following procedure. Similarly, if you type 9:30 a or 9:30 p in a cell, Excel will interpret this as a time and display 9:30 AM or 9:30 PM. Again, you can customize the way the time appears in the Format Cells dialog box.

  1. On the Home tab, in the Number group, click the Dialog Box Launcher next to Number.

    Dialog Box Launcher in Number group

    You can also press CTRL+1 to open the Format Cells dialog box.

  2. In the Category list, click Date or Time.

    Format Cells dialog box

  3. In the Type list, click the date or time format that you want to use.

    Note: Date and time formats that begin with an asterisk (*) respond to changes in regional date and time settings that are specified in Control Panel. Formats without an asterisk are not affected by Control Panel settings.

  4. To display dates and times in the format of other languages, click the language setting that you want in the Locale (location) box.

    Locale box selected in Format Cells dialog box

    The number in the active cell of the selection on the worksheet appears in the Sample box so that you can preview the number formatting options that you selected.

    Sample box selected in Format Cells dialog box

Top of Page

Create a custom date or time format

  1. On the Home tab, click the Dialog Box Launcher next to Number.

    Dialog Box Launcher in Number group

    You can also press CTRL+1 to open the Format Cells dialog box.

  2. In the Category box, click Date or Time, and then choose the number format that is closest in style to the one you want to create. (When creating custom number formats, it’s easier to start from an existing format than it is to start from scratch.)

  3. In the Category box, click Custom. In the Type box, you should see the format code matching the date or time format you selected in the step 3. The built-in date or time format can’t be changed or deleted, so don’t worry about overwriting it.

  4. In the Type box, make the necessary changes to the format. You can use any of the codes in the following tables:

    Days, months, and years    

To display

Use this code

Months as 1–12

m

Months as 01–12

mm

Months as Jan–Dec

mmm

Months as January–December

mmmm

Months as the first letter of the month

mmmmm

Days as 1–31

d

Days as 01–31

dd

Days as Sun–Sat

ddd

Days as Sunday–Saturday

dddd

Years as 00–99

yy

Years as 1900–9999

yyyy

If you use «m» immediately after the «h» or «hh» code or immediately before the «ss» code, Excel displays minutes instead of the month.

Hours, minutes, and seconds

To display

Use this code

Hours as 0–23

h

Hours as 00–23

hh

Minutes as 0–59

m

Minutes as 00–59

mm

Seconds as 0–59

s

Seconds as 00–59

ss

Hours as 4 AM

h AM/PM

Time as 4:36 PM

h:mm AM/PM

Time as 4:36:03 P

h:mm:ss A/P

Elapsed time in hours; for example, 25.02

[h]:mm

Elapsed time in minutes; for example, 63:46

[mm]:ss

Elapsed time in seconds

[ss]

Fractions of a second

h:mm:ss.00

AM and PM     If the format contains an AM or PM, the hour is based on the 12-hour clock, where «AM» or «A» indicates times from midnight until noon and «PM» or «P» indicates times from noon until midnight. Otherwise, the hour is based on the 24-hour clock. The «m» or «mm» code must appear immediately after the «h» or «hh» code or immediately before the «ss» code; otherwise, Excel displays the month instead of minutes.

Creating custom number formats can be tricky if you haven’t done it before. For more information about how to create custom number formats, see Create or delete a custom number format.

Top of Page

Tips for displaying dates or times

  • To quickly use the default date or time format, click the cell that contains the date or time, and then press CTRL+SHIFT+# or CTRL+SHIFT+@.

  • If a cell displays ##### after you apply date or time formatting to it, the cell probably isn’t wide enough to display the data. To expand the column width, double-click the right boundary of the column containing the cells. This automatically resizes the column to fit the number. You can also drag the right boundary until the columns are the size you want.

  • When you try to undo a date or time format by selecting General in the Category list, Excel displays a number code. When you enter a date or time again, Excel displays the default date or time format. To enter a specific date or time format, such as January 2010, you can format it as text by selecting Text in the Category list.

  • To quickly enter the current date in your worksheet, select any empty cell, and then press CTRL+; (semicolon), and then press ENTER, if necessary. To insert a date that will update to the current date each time you reopen a worksheet or recalculate a formula, type =TODAY() in an empty cell, and then press ENTER.

Need more help?

You can always ask an expert in the Excel Tech Community or get support in the Answers community.

Need more help?

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

Learn How Dates Work in Excel

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).

Excel Dates Are Stored as Serial Numbers and Formatted as Dates

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.

Date Functions Have a Serial Number Argument for a Date Value

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.

Excels Date System Starts on January 1st 1900

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.

Keyboard Shortcut to Enter Todays Date Excel Ctrl Semicolon

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.

Calculate the Difference Between Two Dates in Excel - Returns Number of Days

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.

Ust the DAY Function to Return Day of Month in the Pivot Table Source Data

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.

The Time Value is Stored as a Fraction of the Serial Number 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!

Date Time LeadDates and times are two of the most common data types people work with in Excel, but they are also possibly the most frustrating to work with, especially if you are new to Excel and still learning. This is because Excel uses a serial number to represent the date instead of a proper month, day, or year, nevermind hours, minutes, or seconds. It’s made more complicated by the fact that dates are also days of the week, like Monday or Friday, even though Excel doesn’t explicitly store that information in the cells. Here is the definitive guide to working with dates and times in Excel…

How Excel Stores Dates

The source of most of the confusion around dates and times in Excel comes from the way that the program stores the information. You’d expect it to remember the month, the day, and the year for dates, but that’s not how it works…

Excel stores dates as a serial number that represents the number of days that have taken place since the beginning of the year 1900. This means that January 1, 1900 is really just a 1. January 2, 1900 is 2. By the time we get all the way to the present decade, the numbers have gotten pretty big… September 10, 2013 is stored as 41527.

Importantly, any date before January 1, 1900 is not recognized as a date in Excel. There are no “negative” date serial numbers on the number line.

It seems confusing, but it makes it a lot easier to add, subtract, and count days. A week from September 10, 2013 (September 17, 2013), is just 41527 + 7 days, or 41534.

How Excel Stores Times

Excel stores times using the exact same serial numbering format as with dates. Days start at midnight (12:00am or 0:00 hours). Since each hour is 1/24 of a day, it is represented as that decimal value: 0.041666…

That means that 9:00am (09:00 hours) on September 10, 2013 will be stored as 41527.375.

When a time is specified without a date, Excel stores it as if it occurred on January 0, 1900. In other words, 3:00pm (15:00 hours) is stored as 0.625. This can make doing math for time-only values (that have no date) challenging, since subtracting 6 hours (6:00)  from 3:00am (03:00 hours) will become negative and count as an error: 0.125 – 0.25 = -0.125, which is displayed as #########.

Minutes and seconds in Excel work the same way as hours…

A minute is 1/60 of an hour, which is 1/24 of a day, or 1/1440 of a day in total, which calculates to 0.00069444…

A second is 1/60 of an minute, which is 1/60 of an hour, which is 1/24 of a day, or 1/86400 of a day in total, which calculates to 0.00001157407…

Working with Dates and Times

DATE() and TIME()

Serial numbers aren’t all that intuitive to use. Fortunately, Excel has a set of functions to make it easier to find and use dates and times, starting with DATE and TIME. The syntax is as follows:

=DATE(yearmonthday)
=TIME(hoursminutesseconds)

For both functions, specify the year, month, and day, or hours, minutes, and seconds as numbers. For example, September 10, 2013 can be entered as:

=DATE(2013,9,10)

It will be stored as 41527, which means that it is technically storing 12:00am on September 10, 2013.

For times, 6:00pm (18:00 hours) can be entered as:

=TIME(18,0,0)

It will be stored as 0.75, which means that it is technically storing 6:00pm on January 0, 1900.

If we want to represent a specific time and date, we can add the two functions together. For example, 6:00pm (18:00 hours) on September 10, 2013 can be entered as:

=DATE(2013,9,10)+TIME(18,0,0)

It will be calculate as 41527.75, which means Excel is storing exactly the date we want…

Additional Date and Time Setting Functions

Excel has a few additional functions to make declaring dates easier.

TODAY()

The TODAY function always returns the current date’s serial number. The TODAY function is just entered as:

=TODAY()

This article was written at 6:30pm (18:30 hours) on September 24, 2013, and the TODAY function calculated to 41541.  That means that it is technically storing 12:00am on September 24, 2013.

NOW()

A similar function called NOW always returns the current date and time’s serial number. The NOW function is just entered as:

=NOW()

Again,  at 6:30pm (18:30 hours) on September 24, 2013, the function calculated to 41541.77081333… NOW stores the exact time and date, down to the second.

EDATE() and EOMONTH()

The EDATE function gives the date the specified number of months away from the input date. The EOMONTH function gives the date of the last day of the month. It can do so for the current month or a number of months in the future or the past. The syntax for each is as follows:

=EDATE(start_date, months)
=EOMONTH(start_date, months)

The start_date can be any date-formatted cell reference or date serial number.

The months field can be any number, though only the integer value will be used (e.g. it treats 2.8 as 2).

The EDATE and EOMONTH functions strip the time value from the date. For example, For example, if cell A1 stores September 10, 2013, we can get the value 2 months ahead as follows:

=EDATE(A1,2)

Returns 12:00am (0:00 hours) on November 10, 2013, or 41588. This function works even though the months have different numbers of days (September and November have 30, October has 31).

=EOMONTH(A1,2)

Returns 12:00am (0:00 hours) on November 30, 2013, or 41588. Again, this function works even though the months have different numbers of days.

WORKDAY()

Occasionally, it may be useful to count ahead based on work-days (Monday-Friday) instead of all 7 days of the week… For that, Excel has provided WORKDAY. The syntax for WORKDAY is as follows:

=WORKDAY(start_date, days, [holidays])

The start_date is as above.

The days input is the number of workdays ahead (or behind) of the present day you would like to move.

The [holidays] input is optional, but lets you disqualify specific days (like Thanksgiving or Christmas, for example), which might otherwise fall during the work week. These are date serial numbers provided in an array bounded by brackets: { }. To specify multiple holidays, the dates must be held in cells – it is not possible to put multiple DATE functions in an array.

For example, let’s find the date 6 work days before 6:00pm (18:00 hours) on September 10, 2013 (stored in cell A1). Monday, September 2nd is Labor Day, so let’s include that as a holiday:

=WORKDAY(A1,-6,DATE(2013,9,2))

Returns 12:00am (0:00 hours) on August 30, 2013, or 41516. (Note that the function strips the time portion of the date.)

WORKDAY.INTL() (Excel 2010 and newer)

For newer versions of Excel (2010 and later), there is another version of WORKDAY called WORKDAY.INTL. WORKDAY.INTL works just like WORKDAY, but it adds the ability to customize the definition of the “weekend”. The syntax for WORKDAY.INTL is as follows:

=WORKDAY.INTL(start_date, days, [weekend], [holidays])

The start_date, days, and [holidays] inputs work just like the normal WORKDAY function.

The [weekend] input has the following options:

WorkDay.Intl Weekend

Retrieving Dates in Excel

DAY(), MONTH(), and YEAR()

Now we know how define dates, but we still need to be able to work with them. Serial numbers don’t make it easy to extract months, years, and days, nevermind hours, minutes, and seconds. That’s why Excel has specific functions for pulling out each of these values. For working with the calendar, there is DAY, MONTH, and YEAR. The syntax is simple:

=DAY(serial_number)
=MONTH(serial_number)
=YEAR(serial_number)

The serial_number in each can be any date-formatted cell reference. For example, if cell A1 stores September 10, 2013, we can use each of the formulas in turn:

=DAY(A1)

Returns 10 as a numeric value.

=MONTH(A1)

Returns as a numeric value.

=YEAR(A1)

Returns 2013 as a numeric value.

We could have also given the direct serial number for September 10, 2013:

=DAY(41527)

Returns 10 as a numeric value.

Retrieving Times in Excel

HOUR(), MINUTE(), and SECOND()

For times, the process is very similar. Excel has function to retrieve the hours, minutes, and seconds from a time stamp, conveniently named HOUR, MINUTE, and SECOND. The syntax is identical:

=HOUR(serial_number)
=MINUTE(serial_number)
=SECOND(serial_number)

The serial_number in each can be any time/date-formatted cell reference. For example, if A1 stores 6:15:30pm (18:15 hours, 30 seconds) on September 10, 2013, we can use each of the formulas in turn:

=HOUR(A1)

Returns 18 as a numeric value.

=MINUTE(A1)

Returns 15 as a numeric value.

=SECOND(A1)

Returns 30 as a numeric value.

We could have also given the direct serial number for  6:15:30pm (18:15 hours, 30 seconds) on September 10, 2013:

=SECOND(41527.7607638889)

Returns 30 as a numeric value.

Additional Date Retrieving Functions

WEEKDAY() and WEEKNUM()

Dates don’t just have month and year information. They also encode indirect information… September 10, 2013 happens to also be a Tuesday. Excel has a few of functions to work with the week aspect of dates: WEEKDAY and WEEKNUM. The syntax is as follows:

=WEEKDAY(serial_number, [return_type])
=WEEKNUM(serial_number, [return_type])

The serial_number in each can be any date-formatted cell reference. Since [return_type] is optional, each function assumes that each week starts on Sunday. If cell A1 stores September 10, 2013 (a Tuesday), we can use each of the formulas in turn:

=WEEKDAY(A1)

Returns 3, since Tuesday is the 3rd day of a week that starts on Sunday.

=WEEKNUM(A1)

Returns 37, since September 10, 2013 is in the 37th week of 2013, when you start counting weeks from Sunday.

The [return_type] allows you to specify a different default week arrangement. You could let the week start on Monday and run until Sunday, or Saturday until Friday, for example. Excel is annoying, however, and makes the entry different for WEEKDAY and WEEKNUM. The full list of options for WEEKDAY is as follows:

Week Return Type

Options 2 and 11 are functionally the same – the first is just there for backwards compatibility with earlier versions of Excel.

The full list of options for WEEKNUM is as follows:

WeekNum Return Type

Counting and Tracking Dates

Dates can be added and subtracted like normal numbers because they’re stored as serial numbers. That lets you count the days between two different dates. Sometimes, though, you need to count by a different metric.

NETWORKDAYS()

Above, we learned about WORKDAY, which lets you move back and forth a set number of workdays, ignoring weekends and holidays. But what if you need to measure the number of workdays between two dates? For that, Excel provides NETWORKDAYS. The formula syntax is as follows:

=NETWORKDAYS(start_date, end_date, [holidays])

The start_date and end_date can be any date-formatted cell reference.

The [holidays] input is optional, but lets you disqualify specific days (like Thanksgiving or Christmas, for example), which might otherwise fall during the work week. These are date serial numbers provided in an array bounded by brackets: { }. To specify multiple holidays, the dates must be held in cells – it is not possible to put multiple DATE functions in an array.

For example, if A1 contains 6:00pm (18:00 hours) on September 10, 2013 and B1 contains 9:00am (9:00 hours) on December 2, 2013, we can use NETWORKDAYS to find the number of workdays between the two dates.

Let’s exclude Columbus Day (October 14, 2013), Veterans Day (November 11, 2013), and Thanksgiving Day (November 28, 2013) as holidays. To do so, we have to store those dates in other cells. Let’s put them in C1, C2, and C3:

=DATE(2013,10,14)
=DATE(2013,11,11)
=DATE(2013,11,28)

Now, we can combine them in the function:

=NETWORKDAYS(A1,B1,C1:C3)

The function returns 57 as a numeric value.

NETWORKDAYS.INTL() (Excel 2010 and newer)

For newer versions of Excel (2010 and later), there is another version of NETWORKDAYS called NETWORKDAYS.INTLNETWORKDAYS.INTL works just like NETWORKDAYS, but it adds the ability to customize the definition of the “weekend”. The syntax for NETWORKDAYS.INTL is as follows:

=NETWORKDAYS.INTL(start_date, end_date, [weekend], [holidays])

The start_dateend_date, and [holidays] inputs work just like the normal WORKDAY function.

The [weekend] input has the following options:

NETWORKDAYS.Intl Weekend

YEARFRAC()

Sometimes it’s useful to measure how much time has passed in years, but subtracting the YEAR function will only round down to the nearest full year. YEARFRAC takes two dates and provides the portion of the year between them. The syntax is as follows:

=YEARFRAC(start_date, end_date, [basis])

The start_date and end_date can be any date-formatted cell reference.

The [basis] input is optional, but lets you specify the “rules” for measuring the difference. Most of the time, you’ll want to use option 1, but here is the full list:

YearFrac BasisFor example, if A1 contains September 10, 2013 and B1 contains December 2, 2013, we can use YEARFRAC to find the decimal portion of a year between the two dates:

=YEARFRAC(A1,B1,1)

Returns 0.227397260273973.

DATEDIF() (Undocumented Function)

The YEARFRAC function gives you the difference between dates as a fraction of a year, but sometimes you need more control. There is a powerful hidden function in Excel called DATEDIF that can do much more. It can tell you the number of years, months, or days between two dates. It can also track based on only partial inputs, ignoring years or months when calculating days. The syntax for DATEDIF is as follows:

=DATEDIF(start_date, end_date, unit)

The start_date and end_date can be any date-formatted cell reference.

The unit input asks you to specify a string that represents the type of output you want. This is slightly cumbersome, since you must wrap the input in quotes (” “).

For example, if A1 contains September 10, 2012 and B1 contains December 2, 2013, we can use DATEDIF to find the number of full years between the two dates:

=DATEDIF(A1,B1,"Y")

Returns 1 as a numeric value.

Using the same start_date and end_date inputs, here are the output possibilities for DATEDIF using different unit parameters:

DateDif Unit

Every time, the unit must be put in quotes (e.g. “Y” or “MD”).

Converting Dates and Times from Text

DATEVALUE() and TIMEVALUE()

All of the above functions work perfectly with date-formatted serial numbers in Excel. Unfortunately, dates and times are often imported into worksheets as text. Most of the assorted functions like MONTH and HOUR are reasonably intelligent about converting on the fly. Occasionally it’s useful to build a date value through concatenation. The two functions Excel provides for this purpose are DATEVALUE and TIMEVALUE. The syntax for each is as follows:

=DATEVALUE(date_text)
=TIMEVALUE(time_text)

The date_text and time_text accept any text string that looks like a date or time.

This is how DATEVALUE responds to various date_text inputs:

DateValue Text Examples

This is how TIMEVALUE responds to various time_text inputs:

TimeValue Text Examples

Converting Dates and Times to Text

TEXT()

Getting data converted to dates and times is great, but you may also need to get it back out. Sometimes, you need a special format. Other times, you need to look for a date in a text string, and have to match using string tools like FIND and SEARCH. There is one master function for converting dates and times to text strings in Excel, called TEXT. The syntax for TEXT is as follows:

=TEXT(value, format_text)

The value can be any date or time-formatted cell reference.

The format_text input has a large number of options, summarized here:

Text Format_Text Inputs

The outputs can be combined with simple formatting characters to produce standard date formats. Using the date 5:07:03am (05:07 hours, 3 seconds) on September 10, 2013, here are examples of possible outputs:

Text Output Examples

A Common Problem

One issue people frequently run into is that Excel occasionally misinterprets text fields as dates. An example is here:

Common Error

Be careful when entering dates, especially if you are importing from other data sources, to make sure that your “Jan-13” is being stored as January 1, 2013 and not January 13, 2013!

Get the latest Excel tips and tricks by joining the newsletter!

Andrew Roberts ThumbnailAndrew Roberts has been solving business problems with Microsoft Excel for over a decade. Excel Tactics is dedicated to helping you master it.

Join the newsletter to stay on top of the latest articles. Sign up and you’ll get a free guide with 10 time-saving keyboard shortcuts!

Other posts in this series…

In Microsoft Excel, the date can be inserted in a variety of ways, including using a built-in function formula or manually entering the date, such as 22/03/2021, 22-Mar-21, 22-Mar, or March 22, 2021. These date functions are typically used for cash flows in accounting and financial analysis.

In Excel, there is a built-in function called TODAY() that will insert the exact today’s date and will give the updated date whenever the workbook is opened. The NOW() built-in function can also be used to insert the current date and time, and this function will be kept up to date if we open the workbook multiple times.

Inserting the date:

In the Formula tab, the built-in TODAY is categorized under the DATE/TIME function.

 Alternate to insert the date in Excel the below keyboard shortcut can be used:

CTRL+; 

It will insert the current date.

To insert the current date and time we can use the following shortcut keys:

CTRL+; <space key> CTRL+SHIFT+;

It returns the current date and time to us.

1. Inserting specific date in Excel:

We have to use DATE() to insert a specific valid date in Excel. We can notice in the above function that the DATE requests to provide Year, Month, Day values. If we provide the details, the default date will be shown as below:

Image 1.1

Image 1.2

2. Inserting static date and time: 

A static value in a sheet does not change if the sheet is recalculated or opened. To do so follow the below steps:

Step 1: Select the cell in which the current date or time will be inserted on a table.

Step 2: Do one of the next:

  • Press Ctrl+;(semi-colon) to insert your current date.
  • Press the Ctrl+Shift+;(semi-colon) to insert the current time.
  • Press Ctrl+;(semi-column) to insert the current date and time then press Space, and press Ctrl+Shift+; (semi-colon).

Static date and time 

3. Inserting a date in Excel via a drop-down calendar:

It may be a good idea to include a down calendar in your worksheet if you set up a table for other users and want to make sure that the dates enter correctly. You can fill in the dates with a mouse click and be 100% confident that all dates are entered in a suitable format. You can use Microsoft Date Picker control when you use a 32-bit version of Excel. Microsoft Date Picker Control will not work when you are using a 64-bit Excel 2016, Excel 2013 version.

4. Inserting an automatically updatable today’s date and current time:

If you want to keep your Excel date up-to-date today, use one of the following Excel date functions:

=TODAY() -> inserts in a cell the current date.
=NOW() -> inserts in a cell the current and current date.

=TODAY example

=NOW example

Please remember that when using the Excel date functions:

  1. The date and the time returned will not be refreshed on an ongoing basis, but only when the chain is reopened or re-calculated.
  2. The functions take the current system clock date and time.

5. Auto-populate dates in Excel

To autofill a series of dates in which one day is incremented, you can use the Excel AutoFill function. It is a common way to automatically fill a column or row. To do so follow the below steps:

  • Enter the original date in the first cell.
  • Click the first date on your cell and then drag the fill handle to or from the cells you want Excel to add dates.

Autofill weekdays, months, or years:

There are two ways of automatically adding weekdays, months, or years to the selected range of cells. To so follow the below steps:

  1. You can use the above-mentioned Excel AutoFill options. Click the AutoFill Options icon and choose the option you want when the range is populated by sequential dates.
  2. Another way to enter your first date will be to right-click the fill handle and drag and release the fill handle through the cells you automatically want to fill with dates. Excel displays a context menu and selects the appropriate option.

 Auto-populate dates

Skip to content

All Excel’s Date Functions Explained + Time Functions Too! [+5500 words]

All Excel’s Date and
Time Functions Explained!

Written by co-founder Kasper Langmann, Microsoft Office Specialist.

This is the complete guide to date and time in Excel.

It’s a whopping +5500 words (!), so be sure to bookmark it.

The first part of the guide shows you exactly how to deal with dates in Excel.

I will show you how to perform calculations involving dates. We’re also going to look at some of Excel’s (awesome) built-in functions. These allow you to extract just what you need from data that includes dates.

In the second part of the guide, I’ll show you how to work with time data in a spreadsheet.

This is going to be a lot of fun. Grab a cup of coffee, and let’s start rolling!

Kasper Langmann, Co-founder of Spreadsheeto
  • 7: Date formatting

    • What is date formatting?
    • How to use other date formats (from the ‘Format Cells’ dialog box)
    • How to use custom date format
    • Turn text into dates with the DATEVALUE function
    • How to auto populate date in Excel when a cell is updated
    • How to insert a date picker in Excel

Get your FREE exercise file

Before you start:

Throughout this guide, you need a data set to practice.

I’ve included one for you (for free).

Download it right below!

Introduction to
calculations with dates

When analyzing and manipulating date information in Excel, you have several formatting options.

In other words, you can display your data in many ways.

Most of the time, Excel will know that you are entering a date when you key in the data like the following:

  • 1/1/2017
  • January 1, 2017
  • 1-Jan

The clearest sign that Excel has stored your data in a cell as a date is that it should be right-aligned in the cell.

Kasper Langmann, Co-founder of Spreadsheeto

Below are a few examples of the various formats that Excel displays dates in.

But the key is that they are all aligned to the right of the cell.

Data formatted as data versus text

Contrast column A with column B (where the cells are formatted as text). They show the same information.

But, the alignment to the left side of the cell indicates that they are not formatted as a date. As you will soon see, this presents problems when performing calculations with dates.

Kasper Langmann, Co-founder of Spreadsheeto

One important note about how Excel stores dates:

To use dates in calculations, Microsoft Excel stores dates as serial numbers.

These are the sequential number of the day in relation to the starting date of January 1, 1900.

Short data format and serial number

So, think of January 1, 1900, as serial number 1.

January 1, 2016, would be serial number 42370 as it’s 42,370 days after January 1, 1900.

For this reason, dates need to be in a date format rather than text format. If stored in text format, their serial number will not be stored in Excel. This is a no-go as you need these serial numbers when you want to perform calculations involving dates.

Kasper Langmann, Co-founder of Spreadsheeto

How to add time to dates in Excel

Now you know the fundamentals of date formatting versus date data formatted as text. Let’s look at some calculations you can do with dates.

First, why don’t we look at how to add days to a date?

Kasper Langmann, Co-founder of Spreadsheeto

How to add days to a date

Adding days to a date is very simple, straightforward, and intuitive.

All you need to do is add the number of days as a single number to the date or cell reference containing the date.

The following figure illustrates just how simple it is to add 1 day or 90 days to a date.

Example of adding days

How to add months to a date

If you need to add a month or several months to your date, the process is a bit more complicated.

For this calculation, you will need to call upon the built-in Excel function, EDATE. The syntax for EDATE is so simple, that you will pick it up in no time at all.

Kasper Langmann, Co-founder of Spreadsheeto

Here’s its syntax:

=EDATE(start_date, months)

The function requires 2 arguments: ‘start_date’ and ‘months’.

The first, ‘start_date’, is simply the date we are adding months to.

The second, ‘months’, is the number of months we would like to add to the date.

Look at the figure below to see just how easy it is to calculate a new date by adding 6 months and 9 months to the start date.

Adding months to a date

How to add years to a date

So, what about calculating the addition of years to your original date?

For this, you need to use a few more functions. But, as noted before, this is super intuitive so don’t let the length of these formulas fool you.

Kasper Langmann, Co-founder of Spreadsheeto

The first function we need to focus on is DATE.

The syntax for DATE is also incredibly simple and intuitive:

=DATE(year, month, day)

But, for our purposes, we can use the YEAR, MONTH, and DAY functions along with DATE.

These functions extract the correct data from our original date. This ensures appropriate use of our final DATE formula.

For example, applying MONTH to a cell reference of our original date will extract the month data. The same is true for YEAR and DAY.

So, we will place these functions in the appropriate argument within the DATE function. And if we want to add 1 year to the date, we simply place a ‘+1’ after the YEAR function in the ‘year’ argument of the DATE function.

Kasper Langmann, Co-founder of Spreadsheeto

That was a lot, so let’s look at the following figure to see it in action.

The function DATE in action

Notice row 18 and column C of the worksheet.

The ‘year’ argument of the ‘DATE’ function is substituted by the function ‘YEAR(A18)+1’.

This tells the DATE function that we want the year only from the date data in A18 (or 2017) – and that we want to add ‘1’ to it (or 2018).

How to subtract dates

Adding time to a date is super useful.

But what if you had a report where you needed to calculate the difference between dates?

This is where we turn our attention to subtracting dates…

Kasper Langmann, Co-founder of Spreadsheeto

Find the difference between two dates

To find the difference between two dates, we want to turn our attention to the DATEDIF function.

The most important thing you need to know about DATEDIF is that it is a hidden function. What that means is that it will not be found in the visible list of Excel functions on the formula tab.

Kasper Langmann, Co-founder of Spreadsheeto

This requires you to type the formula in its entirety.

There will be no tooltip hint as you begin to type the function.

Let’s look at the syntax:

=DATEDIF(start_date, end_date, unit)

There are three arguments for the DATEDIF function:

  • start_date: This is the initial date of the period among the two you are calculating the difference between.
  • end_date: This is the latest date of the two.
  • unit: This is the unit in which you want the function to return the difference by. More on units right below…

The ‘unit’ argument gives you a choice of several formats to return your results from DATEDIF.

  • y – The number of complete years between dates.
  • m – The number of complete months between dates.
  • d – The number of days between dates.
  • md – The number of days ignoring months and years.
  • yd – The number of days ignoring years.
  • ym – The number of months ignoring days and years.

So, let’s look at a few examples using DATEDIF in various forms.

Kasper Langmann, Co-founder of Spreadsheeto
Function DATEDIF

In our example, you can use literal dates if they are enclosed in double quotes.

You can also use the serial number format as shown in rows 4 and 5.

Now note the difference in the returned value between row 2 and 3. The ‘start_date’ and the ‘end_date’ are unchanged. But, our results are different. The first formula returns the total number of days between the dates.

Kasper Langmann, Co-founder of Spreadsheeto

But in the second example, we use ‘md’ for the unit argument. ‘md’ is the difference between the dates in days – ignoring the months and years. That is 15 minus 1, or 14 days.

You can also calculate the difference between two dates in cells.

To do this, place the cell reference of your dates in the ‘start_date’ and ‘end_date’ arguments.

Difference between two dates in cells

One (last) important thing to note about using DATEDIF:

The ‘end_date’ argument must always be later than the ‘start_date’ or you will get the ‘#NUM!’ error.

Use today’s date in Excel

Now let’s turn our attention to some tricks and shortcuts involving the current date.

Often, you need to work with the current (today’s) date.

There are some nifty tricks that allow you to do this without typing in the entire date manually.

Let’s look at them!

Use date that updates itself with the TODAY function

One of the simplest ways to input today’s date into a cell is to use the TODAY function.

Do this by typing ‘=TODAY()’ into a cell.

This places the current date into the cell dynamically. So, that cell would have tomorrow’s date in it if you reopen the file tomorrow.

You can also nest the TODAY function within the DAY or MONTH function. This return only the current day or current month in a cell. Refer to the following figure to see the TODAY function in action.

Kasper Langmann, Co-founder of Spreadsheeto
TODAY function

Insert static current date in Excel using shortcuts

You can also insert the current date using keyboard shortcuts.

For the current date, press the following key combination:

Ctrl + ;

To insert both the date and the time, press the previous keyboard shortcut. Then press the following combination:

Ctrl + Shift + ;

These shortcuts enter static dates and times. This opposed to the dynamic date that the TODAY function returns.

Subtract a date from the current date

You can use the current date in a calculation like subtracting.

You replace the ‘start_date’ argument in the DATEDIF formula.

Subtract a date with DATEDIF

Above image shows how to substitute the TODAY function for a literal date value or cell reference for the ‘start_date’ OR the ‘end_date’.

Remember the rule that the ‘end_date’ must be later than the ‘start_date’ still applies.

Using the TODAY function in a calculation is useful when you need to track a time period dynamically. Say you need to calculate some sort of countdown to a deadline. Using the TODAY function in your calculation is the perfect way to do this.

Kasper Langmann, Co-founder of Spreadsheeto

You can also use the keyboard shortcut to insert the current date if you need to insert the static date. This is a quicker and more efficient way to insert today’s date.

Retrieving numbers from dates
with Date functions

There are often situations where you need to retrieve numbers from dates.

But, you might not have the need for an entire date.

Let’s say you have a report. Here you want to separate the different elements of the date for filtering by a single element of the date – like the month or year.

Here’s how to go about doing that 🙂

Use the DAY function to find the day of a date

To isolate only the day of the full date, we use the DAY function.

There is a single argument for the DAY function:

=DAY(serial_number)

You probably know by now that ‘serial_number’ is the date.

This argument can be the actual serial number form of the date or the literal date in double quotes. It can also be a cell reference like in the following example.

DAY function

Look at above picture again. Notice that regardless of the format of your original date, the DAY function returns the value ‘14’.

Use the MONTH function to find the month of a date

If you need to isolate the number value for the month of your original date, you can use the MONTH function.

It works the same way the DAY function works:

=MONTH(serial_num)

MONTH function

Use the YEAR function to find the year of a date

Now we move onto the function that retrieves the number value for the year part of the date.

The syntax for the ‘YEAR’ function is like the DAY and MONTH functions syntactically.

=YEAR(serial_num)

You already know how to retrieve the day and month number values. It’s the exact same concept when using the ‘YEAR’ function.

YEAR function

Use the WEEKDAY function to find the day of the week

You can also retrieve the number value for the day of the week from a date.

The WEEKDAY function returns the number that corresponds to the day of the week. For instance, 1 for Sunday, 2 for Monday, 3 for Tuesday, and so on.

Kasper Langmann, Co-founder of Spreadsheeto

Here’s its syntax:

=WEEKDAY(serial_num, [return_type])

The syntax for WEEKDAY requires the ‘serial_number’ argument.

It also allows for an optional argument: ‘return_type’.

This allows you to choose a different start and end date for your week.

That means that the returned value will align with that chosen sequence.

Below you can see the list of different ‘return_type’ values that Excel allows.

WEEKDAY function

In the following examples, note the value differences returned by the formula based on the ‘return_type’ argument.

Value differences returned by formula based on ‘return_type’ argument

The different selections for the ‘return_type’ in the formulas return very different weekday values.

These depend on the first day of the week that corresponds to those ‘return_type’ values.

Use the WEEKNUM function
to find out the week number

Another interesting built-in function is the WEEKNUM function.

WEEKNUM retrieves the number value for the week of the year that the original date falls within (1 – 52).

So, if the original date is between January 1 and January 7, the WEEKNUM value would be ‘1’.

If the date is between December 25 and December 31, WEEKNUM would return the value ‘52’.

=WEEKNUM(serial_number, [return_type])

The ‘return_type’ argument corresponds to different days you can choose as the start day. This changes the week number based on what day of the week that the ‘return_type’ sets as the first day of the year.

Kasper Langmann, Co-founder of Spreadsheeto
WEEKNUM function

Our date falls on a Monday.

The result of the WEEKNUM formula will be different if the ‘return_type’ argument is ‘1’ (Sunday) versus ‘12’ (Tuesday).

This can be useful since the calendar year begins on different days of the week. This comes in handy if want to calculate the week number based on the first full week of the year.

Kasper Langmann, Co-founder of Spreadsheeto
WEEKNUM example

This can be a very useful function.

Consider a situation in which you needed a weekly countdown. Simply calculate the difference between dates using the WEEKNUM function.

Use the WORKDAY function to calculate the number of working days between two dates

Another useful function is the WORKDAY function.

This function returns a day that is some number of workdays into the future or before some date. A “workday” is days excluding weekends and any holidays that are specified.

The function requires two arguments and has an optional third.

=WORKDAY(start_date, days, [holidays])

  • start_date this required argument is the date from when you want to count the number of workdays
  • days this required argument is the number of days from the start date you want a count of. Using a negative number will give you the date that many workdays before your start date.
  • holidays this argument is optional. This allows you to add holiday dates in the formula for the WORKDAY function to skip along with weekends.

This is a bit more complex than the functions we have been discussing. Let’s look at a few examples to help the concept of the WORKDAY function sink in.

Kasper Langmann, Co-founder of Spreadsheeto
Function WORKDAY

First, note that we have listed 3 holiday dates in cells A8, A9, and A10. We will be using these in our examples for the ‘holiday’ argument to exclude along with weekends.

On row 2, we want to know the date that is 90 workdays from Monday, November 14, 2016.

Excluding the weekends and holidays (A8:A10), this will be Tuesday, March 21, 2017 according to the WORKDAY function.

On row 3, we can instantly see the effect of weekends and holidays on the outcome of our formula. We want the date that is 2 workdays from Wednesday, November 23, 2017.

Because of the holiday on Thursday, November 24 – and the weekend days Saturday and Sunday – the result is Monday, November 28, 2016.

This example illustrates how powerful the WORKDAY function can be. It calculates something very simple. Yet, if done manually, this is a very cumbersome process.

Kasper Langmann, Co-founder of Spreadsheeto

The third example in the figure illustrates how to use WORKDAY to find a date before the start date.

We want to know the date that is 20 workdays before Monday, January 17, 2017.

So, our DAY argument needs to be a negative value (-20).

Again, note the result considers weekend days as well as a couple of holidays.

How to auto fill dates

In this section, we are going to cover how to work with sequences of dates. This time by using the autofill capability of Microsoft Excel.

You can use Autofill in 2 ways.

The first is to double-click the fill handle. The fill handle is a small square that appears in the lower right corner of a highlighted cell.

The second option is to simply drag the handle to the desired cell. Note the fill handle for the highlighted cell in the following figure.

Auto fill handle

The fill handle also offers some more options.

Try to right-click and drag outside the selection a bit.

Auto fill menu

We will focus on the selections that fill elements of the date like days, weekdays, months, and years.

Insert dates that increase by one day

To insert dates that increase by one day in a column, you can simply grab the fill handle.

Then drag it down as many rows as you need dates for.

One thing to take note of is that as you do this, Excel shows the incremented date as you drag the range.

So, you can see just what date you are at as you expand the range.

Expand range

Once you release the fill handle, your range is now filled with dates.

These dates increment in one-day intervals.

Range expanded

Insert dates that increase by weekdays

But what if you wanted to increment a wide range of dates by weekdays only?

This is easily done by selecting ‘Fill Weekdays’ from the ‘Autofill Options’ that appears once you fill the dates down.

Fill weekdays

Once you select ‘Fill Weekdays’, Excel automatically excludes any weekend dates from the range.

Weekdays added

Insert dates that increase by months and years

You can also use the ‘Autofill Options’ to increase months and years.

Select the fill option you need once you fill the dates down to the last cell of your range.

Autofill examples

Insert dates that increase by several days

I’m sure you can think of other custom intervals (dates) you might like to fill down your column (or row, for that matter).

Microsoft Excel allows for a little of that also.

So, what if you wanted to increment every other day? Or what about every 3 months?

These other intervals are available using auto fill. Drag down the dates by using the fill handle. Then right click and hold on the fill handle while moving the cursor slightly outside the range. Now release until you see the options menu.

Kasper Langmann, Co-founder of Spreadsheeto
Series

Click on ‘Series…’. The Series dialog box will now open.

This gives you several options for customizing the intervals of your dates.

Series dialog box

For our example of every other day, you can select a Step value of ‘2’.

Leave everything else as it is.

Every other day

Date formatting:
Make a date easy to interpret

In the beginning of this tutorial, I told you about the differences between text format and date format.

Now, we’re going to take a deeper dive into formatting of dates. We can represent date data in different date formats. These are easily adjusted according to our preferences and needs.

Kasper Langmann, Co-founder of Spreadsheeto

Also, remember our point earlier, that Excel stores date data as serial number.

So, no matter what date format you choose, Excel still recognizes it as a serial number.

What is date formatting?

Date formatting offers you choices on how you want to represent the date data in your worksheets.

Let’s look at our original example at the beginning of this tutorial.

We can see in the Number group of the Home tab that our data cells are all formatted as Date.

Date formatting

If you take the same data and place it into another column, something interesting happens.

In the cells that are formatted as ‘General’, you’d see the dates serial numbers.

Formatted as date and general

If you run into this in your own spreadsheets, you must know how to fix this…

It’s quite simple, you just need to know how to reformat those cells into the Date format that you need.

For this example, let’s reformat to ‘Short date’.

Highlight the cell containing the serial number. Click on the drop-down arrow to see all the available formats in the Number group of the Home tab.

Short date

Select ‘Short Date’ from the dropdown and now the serial number will be converted from ‘General’ format to a date format that you recognize.

Short date applied

How to use other date formats
from the ‘Format Cells’ dialog box

You’ve now seen how to change date data formatted as ‘General’ to the ‘Short Date’ format.

Now we look at some other date formats that Excel also offers…

You already know how to change to a date format from the ribbon but you can also use the ‘Format Cells’ dialog box.

The first step is to find the cell that contains the serial number you want to reformat.

Then, right-click on the cell.

Select ‘Format Cells’ from the menu that appears.

Format cells dialog box

From the Format Cells dialog box, select ‘Date’ in the Category box.

This reveals the different standard date format types available in Excel.

You find these formats in the Type box on the right side of the Format Cells dialog box. As you change Type selections, you can view a sample of the actual value in the cell you have selected in the Sample box.

Kasper Langmann, Co-founder of Spreadsheeto
Format cells as date

Decide on the ‘Type’ you want.

Then click ‘OK’ and the serial number now changes to the date format type you selected.

Converted date

How to use custom date format

Even with all the date types Excel offers, you can still format your date data with your own custom format.

It is pretty simple to do…

Follow the same steps as we did with the previous example.

But, instead of choosing ‘Date’ in the Category box in the Format Cells dialog box, select ‘Custom’.

Format cells as custom

Take a second look at the picture above.

Here the Format Cells dialog box shows the current format of the cell in the Type and Sample boxes.

Now you can select from the various default types available. You can also edit those types in the Type box or type in one that is completely custom.

Kasper Langmann, Co-founder of Spreadsheeto

Let’s clear out the Type box…

Clear type box

And then type “mm-dd-yyyy”  into that box:

mm-dd-yyyy

Again, note that as we do this, the Sample box shows us our exact data as it will look under our new custom format. Click ‘OK’ and you are done creating your own custom date format.

Kasper Langmann, Co-founder of Spreadsheeto

Turn text into dates with the DATEVALUE function

Another method for converting dates in text format is to use a function called DATEVALUE.

This function converts text string dates to their appropriate serial numbers.

These serial numbers are, as you know by now, the way Excel recognizes dates. You can format this output according to the methods I’ve shown you in the prior sections.

Kasper Langmann, Co-founder of Spreadsheeto

The DATEVALUE syntax is simple:

=DATEVALUE(date_text)

So, let’s look at a few examples of cells containing dates that are in text string form.

Let’s use the DATEVALUE function in the column next to these cells.

Here it’s easy to see if the cells return the serial numbers we expect.

DATEVALUE

If your text date is before the year 1900, the DATEVALUE function will return the ‘#VALUE!’ error.

That’s because Excel recognizes dates as serial numbers beginning at January 1, 1900.

If your text date doesn’t contain a year, the DATEVALUE function defaults to the current year from your system clock.

How to auto populate date when a cell is updated

What if you wanted to make sure each time a cell’s data got updated, you knew when it was updated?

You could input the date and time manually in the cell next to it.

But what if you wanted to automate that process?

That way you’ll never forget to do it. Also, you would mitigate the chances for a data entry error.

There are several ways to approach this. One of the best ways is to use VBA to create a worksheet change event. It is a macro that automatically runs when a cell’s value changes.

Kasper Langmann, Co-founder of Spreadsheeto

A quick recommendation:

Excelribbon.tips.net has written an awesome guide that demonstrates a worksheet change event. Make sure to check it out!

How to insert a date picker in Excel

Another cool thing you can do in Excel with dates is to create a date picker. This allows users to choose a date from a preset dropdown calendar. That way they don’t have to input the date by hand.

This is actually a pretty complex proposition in Excel. But if you want to see a date picker and a bit about how one can be created using VBA. Contextures has an amazing guide to do it right here.

Calculations with Time

Maybe you need to quantify elapsed time for tasks or projects?

Or perhaps you need to insert a time rather than a date in your data?

There are many parallels between the techniques of working with dates and time.

How to add time in Excel

Let’s look at a scenario where you have documented the total time it took for two different tasks in Excel.

Now you want to add those together to get your total time worked.

This is as simple as clicking on the cell below the task times and pressing Alt + = to autosum the times.

SUM time

Now let’s look at a scenario where you have the times worked for a full workweek that you need to add together for a total.

If we autosum once again, we immediately notice a problem.

AUTOSUM time problem

We know by simple inspection that these workday time values add up to more than 12 hours and 52 minutes.

Excel can display times in a variety of ways. For instance, hours and minutes, 12-hour format, and 24-hour format, and several others.

Kasper Langmann, Co-founder of Spreadsheeto

What we need to do in our current situation is to right click on the cell where our auto sum formula is.

Then select Format Cells like we did with dates.

hours minutes minutes

Then select ‘Custom’ from the Category box and clear the Type box.

Then in the Type box, type ”[h]:mm”.

Click ‘OK’ and you should have the correct total of hours for the week now.

Time correct displayed

How to find the difference between two times

Finding the difference between times is not quite as simple as adding times together.

Let’s look at a situation where we have a start time and an end time and we want to calculate the total elapsed time.

Finding time difference

In cell B4, type the formula ‘=(B3-B2)*24’.

This subtracts the end time from the start time and then multiplies both by 24.

The multiplication by 24 is required since Excel recognizes times as a fraction of a full 24-hour day.

Formula =(B3-B2)*24

Our result is a numerical value and we choose to set it to two decimal places to show fractions of a full hour.

Numerical time difference

If you want to see the elapsed time in the actual hours and minutes, here’s what to do.

Remove the ‘*24’ and format using the custom format we created in the previous example adding times ([h]:mm).

Find current time in Excel

The NOW function allows you to insert the current time based on your computer’s system clock.

NOW returns the current date and time whereas TODAY returns the current date only.

But we can use NOW and format our cell so that it only shows the time but not the date.

NOW function

Insert static current time with shortcuts

You’ve already seen the keyboard shortcut for entering in the static current date as well as entering the static current time.

Since we are discussing time data, I’ll show you how to use a keyboard shortcut to enter the static current time.

All you must do is press the following keyboard combination:

Ctrl + Shift + ;

Again, this contrasts with using the NOW function because it is static rather than dynamic.

This keyboard shortcut inserts the exact time you pressed the keyboard shortcut. It will remain that time unless you manually change it.

Retrieve seconds, minutes and hours

Let’s look at retrieving parts of time data.

This is very much the same as when you retrieved the month, day, and year, from dates. We are going to retrieve the seconds, minutes, and hours with some built-in functions available in Excel.

If you want to retrieve the seconds from a time value in Excel, you use the built-in SECOND function.

There is a single required argument for this function: ‘serial_number’.

=SECOND(serial_number)

Let’s look at a few simple examples to see this function in action:

SECOND function

For times that don’t display the seconds, the SECOND function still retrieves the seconds from the serial number of the date.

If you need to retrieve the minutes from your time data, you want to use the MINUTE function. Like with SECOND function (and others), there is only the required ‘serial_number’ argument.

=MINUTE(serial_num)

Now we will take the same time data we used for the SECOND function and use the MINUTE function.

MINUTE function

The last thing we will look at is the HOUR function. Nothing new on the syntax.

=HOUR(serial_number)

One thing to note about the HOUR function is that it returns a value for the hour based on 24 hours.

So, if you want your HOUR function to return the hour in an AM/PM fashion, subtract 12 from your function if it is a time later than 12 PM.

HOUR function

Formatting time: What is it?

Just like with dates, there are several different format types for time data.

In fact, our examples so far have demonstrated a few of these different formats.

You may want to display times in 12-hour format or 24 hours. You might want your 12-hour format times to show AM and PM, or you may not.

Kasper Langmann, Co-founder of Spreadsheeto
Default time

You find the default time format types by right-clicking a cell.

Then select Format Cells.

Note in the figure above how many variations you can choose from. You can always create your own custom format by selecting ‘Custom’ from the Category list.

How to use and change time formatting

Now we have reviewed how you select different time formats.

Let’s look at a few examples of the different types.

We will look at 3 different selections from those available in the types for time formats.

The first thing we need to do to change format is to right click on the range of dates we want to reformat. Then select Format Cells.

Format cells

Once the Format Cells dialog opens, select ‘Time’ from the Category box. Then in the Type box select ‘*1:30:55 PM’.

Format cells as time

The asterisk in ‘*1:30:55 PM’ indicates that this format changes to the Region settings on your computer.

Any changes to the Windows time format settings will reflect in Excel. But only for the times formatted with a format preceded by an asterisk.

So, we format column B times as ‘*1:30:55 PM’ and then two other formats in columns C and D for the sake of contrast. Look at the different format variations in the following figure.

Kasper Langmann, Co-founder of Spreadsheeto
Examples of different times

Turn text into time with the TIMEVALUE function

The DATEVALUE function converts dates in text string form to date formatting.

Like DATEVALUE, the TIMEVALUE function converts text string time data to actual time format.

See the syntax here:

=TIMEVALUE(text_time)

The ‘text_time’ argument is required. It is simply the text string date that you need to convert to time format.

One thing to recall is that Excel recognizes time as a fraction of 24 hours. For instance, 12 pm would be interpreted by Excel as .5 since it is the halfway point of the 24-hour day.

Kasper Langmann, Co-founder of Spreadsheeto

So, when you use the TIMEVALUE function, you won’t get a time.

Rather, it returns a decimal number value that is a fraction of the entire day.

TIMEVALUE function

If you multiply the TIMEVALUE result by 24, you get a more accurate interpretation of the time (albeit still in decimal format).

TIMEVALUE in 24 hours

But if you reformat the TIMEVALUE result to a time format, you are good to go.

You will have changed a text string time to a true time format that Excel will now recognize as time instead of text.

Wrapping up

There it is, the most comprehensive guide to date and time in Excel.

It’s taken us tons of hours and resources to publish. Feel free to share it along with anyone who needs to brush up their dates and times 😊

If you enjoyed this tutorial, I’m sure you’ll love this…

Kasper Langmann2020-05-11T13:30:38+00:00

Page load link

Like this post? Please share to your friends:
  • 2013 word for mac
  • 2013 microsoft word window
  • 2012 программа для excel
  • 2012 по информатике excel
  • 2012 на работу по word