Excel date functions with formula examples

This is the final part of our Excel Date Tutorial that offers an overview of all Excel date functions, explains their basic uses and provides lots of formula examples.

Microsoft Excel provides a ton of functions to work with dates and times. Each function performs a simple operation and by combining several functions within one formula you can solve more complex and challenging tasks.

In the previous 12 parts of our Excel dates tutorial, we have studied the main Excel date functions in detail. In this final part, we are going to summarize the gained knowledge and provide links to a variety the formula examples to help you find the function best suited for calculating your dates.

The main function to calculate dates in Excel:

Get current date and time:

Convert dates to / from text:

Retrieve dates in Excel:

Calculate date difference:

Calculate workdays:

Excel DATE function

DATE(year, month, day) returns a serial number of a date based on the year, month and day values that you specify.

When it comes to working with dates in Excel, DATE is the most essential function to understand. The point is that other Excel date functions not always can recognize dates entered in the text format. So, when performing date calculations in Excel, you'd better supply dates using the DATE function to ensure the correct results.

Here are a few Excel DATE formula examples:

=DATE(2015, 5, 20) - returns a serial number corresponding to 20-May-2015.

=DATE(YEAR(TODAY()), MONTH(TODAY()), 1) - returns the first day of the current year and month.

=DATE(2015, 5, 20)-5 - subtracts 5 days from May 20, 2015.
Excel DATE formula examples

At first sight, the Excel DATE function looks very simple, however, it does have a number of specificities pointed out in the Excel DATE tutorial.

Below you will find a few more examples where the Excel DATE function is part of bigger formulas:

Excel TODAY function

The TODAY() function returns today's date, exactly as its name suggests.

TODAY is arguably one of the easiest Excel functions to use because it has no arguments at all. Whenever you need to get today's date in Excel, enter the following formula is a cell:

=TODAY()

Apart from this obvious use, the Excel TODAY function can be part of more complex formulas and calculations based on today's date. For example, to add 7 days to the current date, enter the following formula in a cell:

=TODAY()+7

To add 30 weekdays to today's date excluding weekend days, use this one:

=WORKDAY(TODAY(), 30)
Formula examples to get today's date in Excel

Note. The date returned by the TODAY function in Excel updates automatically when your worksheet is recalculated to reflect the current date.

For more formula examples demonstrating the use of the TODAY function in Excel, please check out the following tutorials:

Excel NOW function

NOW() function returns the current date and time. As well as TODAY, it does not have any arguments. If you wish to display today's date and current time in your worksheet, simply put the following formula in a cell:

=NOW()

Note. As well as TODAY, Excel NOW is a volatile function that refreshes the returned value every time the worksheet is recalculated. Please note, the cell with the NOW() formula does not auto update in real-time, only when the workbook is reopened or the worksheet is recalculated. To force the spreadsheet to recalculate, and consequently get your NOW formula to update its value, press either Shift+F9 to recalculate only the active worksheet or F9 to recalculate all open workbooks.

For more details, please see How to use NOW function in Excel.

Excel DATEVALUE function

DATEVALUE(date_text) converts a date in the text format to a serial number that represents a date.

The DATEVALUE function understands plenty of date formats as well as references to cells that contain "text dates". DATEVALUE comes in really handy to calculate, filter or sort dates stored as text and convert such "text dates" to the Date format.

A few simple DATEVALUE formula examples follow below:

=DATEVALUE("20-may-2015")

=DATEVALUE("5/20/2015")

=DATEVALUE("may 20, 2015")
DATEVALUE formula examples

And the following examples demonstrate how the DATEVALUE function can help with solving real-life tasks:

Excel TEXT function

In the pure sense, the TEXT function cannot be classified as one of Excel date functions because it can convert any numeric value, not only dates, to a text string.

With the TEXT(value, format_text) function, you can change the dates to text strings in a variety of formats, as demonstrated in the following screenshot.
Excel TEXT formula examples

Note. Though the values returned by the TEXT function may look like usual Excel dates, they are text values in nature and therefore cannot be used in other formulas and calculations.

Here are a few more TEXT formula examples that you may find helpful:

Excel DAY function

DAY(serial_number) function returns a day of the month as an integer from 1 to 31.

Serial_number is the date corresponding to the day you are trying to get. It can be a cell reference, a date entered by using the DATE function, or returned by other formulas.

Here are a few formula examples:

=DAY(A2) - returns the day of the month from a date in A2

=DAY(DATE(2015,1,1)) - returns the day of 1-Jan-2015

=DAY(TODAY()) - returns the day of today's date
Examples of using the DAY function in Excel

Excel MONTH function

MONTH(serial_number) function in Excel returns the month of a specified date as an integer ranging from 1 (January) to 12 (December).

For example:

=MONTH(A2) - returns the month of a date in cell A2.

=MONTH(TODAY()) - returns the current month.

The MONTH function is rarely used in Excel date formulas on its own. Most often you would utilize it in conjunction with other functions as demonstrated in the following examples:

For the detail explanation of the MONTH function's syntax and plenty more formula examples, please check out the following tutorial: Using the MONTH function in Excel.

Excel YEAR function

YEAR(serial_number) returns a year corresponding to a given date, as a number from 1900 to 9999.

The Excel YEAR function is very straightforward and you will hardly run into any difficulties when using it in your date calculations:

=YEAR(A2) - returns the year of a date in cell A2.

=YEAR("20-May-2015") - returns the year of the specified date.

=YEAR(DATE(2015,5,20)) - a more reliable method to get the year of a given date.

=YEAR(TODAY()) - returns the current year.
Examples of using the YEAR function in Excel

For more information about the YEAR function, please see:

Excel EOMONTH function

EOMONTH(start_date, months) function returns the last day of the month a given number of months from the start date.

Like most of Excel date functions, EOMONTH can operate on dates input as cell references, entered by using the DATE function, or results of other formulas.

A positive value in the months argument adds the corresponding number of months to the start date, for example:

=EOMONTH(A2, 3) - returns the last day of the month, 3 months after the date in cell A2.

A negative value in the months argument subtracts the corresponding number of months from the start date:

=EOMONTH(A2, -3) - returns the last day of the month, 3 months before the date in cell A2.

A zero in the months argument forces the EOMONTH function to return the last day of the start date's month:

=EOMONTH(DATE(2015,4,15), 0) - returns the last day in April, 2015.

To get the last day of the current month, enter the TODAY function in the start_date argument and 0 in months:

=EOMONTH(TODAY(), 0)
EOMONTH formulas to get the last day on the month in Excel

You can find a few more EOMONTH formula examples in the following articles:

Excel WEEKDAY function

WEEKDAY(serial_number,[return_type]) function returns the day of the week corresponding to a date, as a number from 1 (Sunday) to 7 (Saturday).

  • Serial_number can be a date, a reference to a cell containing a date, or a date returned by some other Excel function.
  • Return_type (optional) - is a number that determines which day of the week shall be considered the first day.

You can find the complete list of available return types in the following tutorial: Day of the week function in Excel.

And here are a few WEEKEND formula examples:

=WEEKDAY(A2) - returns the day of the week corresponding to a date in cell A2; the 1st day of the week is Sunday (default).

=WEEKDAY(A2, 2) - returns the day of the week corresponding to a date in cell A2; the week begins on Monday.

=WEEKDAY(TODAY()) - returns a number corresponding to today's day of the week; the week begins on Sunday.
Excel WEEKDAY formulas to return the day of the week

The WEEKDAY function can help you determine which dates in your Excel sheet are working days and which ones are weekend days, and also sort, filter or highlight workdays and weekends:

Excel DATEDIF function

DATEDIF(start_date, end_date, unit) function is specially designed to calculate the difference between two dates in days, months or years.

Which time interval to use for calculating the date difference depends on the letter you enter in the last argument:

=DATEDIF(A2, TODAY(), "d") - calculates the number of days between the date in A2 and today's date.

=DATEDIF(A2, A5, "m") - returns the number of complete months between the dates in A2 and B2.

=DATEDIF(A2, A5, "y") - returns the number of complete years between the dates in A2 and B2.
DATEDIF formulas to calculate the date difference in Excel

These are just the basic applications of the DATEDIF function and it is capable of much more, as demonstrated in the following examples:

Excel WEEKNUM function

WEEKNUM(serial_number, [return_type]) - returns the week number of a specific date as an integer from 1 to 53.

For example, the below formula returns 1 because the week containing January 1 is the first week in the year.

=WEEKNUM("1-Jan-2015")

The following tutorial explains all the specificities on the Excel WEEKNUM function: WEEKNUM function - calculating week number in Excel.

Alternatively you can skip directly to one of the formula examples:

Excel EDATE function

EDATE(start_date, months) function returns the serial number of the date that is the specified number of months before or after the start date.

For example:

=EDATE(A2, 5) - adds 5 months to the date in cell A2.

=EDATE(TODAY(), -5) - subtracts 5 months from today's date.

For a detailed explanation of EDATE formulas illustrated with formula examples, please see: How to use EDATE function in Excel.

Excel YEARFRAC function

YEARFRAC(start_date, end_date, [basis]) function calculates the proportion of the year between 2 dates.

This very specific function can be used to solve practical tasks such as calculating age from date of birth.

Excel WORKDAY function

WORKDAY(start_date, days, [holidays]) function returns a date N workdays before or after the start date. It automatically excludes weekend days from calculations as well as any holidays that you specify.

This function is very helpful for calculating milestones and other important events based on the standard working calendar.

For example, the following formula adds 45 weekdays to the start date in cell A2, ignoring holidays in cells B2:B8:

=WORKDAY(A2, 45, B2:B85)

For the detailed explanation of WORKDAY's syntax and more formula examples, please check out:

WORKDAY function - add or subtract workdays in Excel

Excel WORKDAY.INTL function

WORKDAY.INTL(start_date, days, [weekend], [holidays]) is a more powerful variation of the WORKDAY function introduced in Excel 2010.

WORKDAY.INTL allows calculating a date N number of workdays in the future or in the past with custom weekend parameters.

For example, to get a date 20 workdays after the start date in cell A2, with Monday and Sunday counted as weekend days, you can use either of the following formulas:

=WORKDAY.INTL(A2, 20, 2, 7)

or

=WORKDAY.INTL(A2, 20, "1000001")

Of course, it might be difficult to grasp the essence from this short explanation, but more formula examples illustrated with screenshots will make things really easy:

WORKDAY.INTL - calculating workdays with custom weekends

Excel NETWORKDAYS function

NETWORKDAYS(start_date, end_date, [holidays]) function returns the number of weekdays between two dates that you specify. It automatically excludes weekend days and, optionally, the holidays.

For example, the following formula calculates the number of whole workdays between the start date in A2 and end date in B2, ignoring Saturdays and Sundays and excluding holidays in cells C2:C5:

=NETWORKDAYS(A2, B2, C2:C5)

You can find a comprehensive explanation of the NETWORKDAYS function's arguments illustrated with formula examples and screenshots in the following tutorial:

NETWORKDAYS function - calculating workdays between two dates

Excel NETWORKDAYS.INTL function

NETWORKDAYS.INTL(start_date, end_date, [weekend], [holidays]) is a more powerful modification of the NETWORKDAYS function available in Excel 2010 and later. It also returns the number of weekdays between two dates, but lets you specify which days should be counted as weekends.

Here is a basic NETWORKDAYS formula:

=NETWORKDAYS(A2, B2, 2, C2:C5)

The formula calculates the number of workdays between the date in A2 (start_date) and the date in B2 (end_date), excluding the weekend days Sunday and Monday (number 2 in the weekend parameter), and ignoring holidays in cells C2:C5.

For full details about the NETWORKDAYS.INTL function, please see:

NETWORKDAYS function - counting workdays with custom weekends

Hopefully, this 10K foot view on the Excel date functions has helped you gain the general understanding of how date formulas work in Excel. If you want to learn more, I encourage you to check out the formula examples referenced on this page. I thank you for reading and hope to see you again on our blog next week!

595 comments

  1. Hi,Svetlana Cheusheva
    what formula shall I apply to minus a fraction from a date? ie; 2/9/2016 - 1/3 or 2/9/2016 * 1/3 or 2/9/2016 + 1/3..
    what will be the next date if such is calculated?

    thanks

  2. Hi,

    I have drop list (monthly, quarterly and annually) I want the end date of the contract automatically changed based on my selection of the drop list

    If I choose monthly, the end date will be 1 month after the effective date
    If I choose quarterly, the end date will be 3 months after the effective date

    and so on

  3. I am not sure if a question similar to this has been answered. I need to calculate dates pertaining to the service and filing of certain documents with a court.

    Here are the big factors:

    The document has to be filed with the Courthouse on the "Entry Day." The entry day is ALWAYS a Monday and MUST be a Monday.

    In order for the filing to be accepted by the Court, it has to have been served upon the other party between 7 and 30 days before the Entry Day. We can call this the "Service Period."

    So, using an Entry Day of 8/29/2016, the document would need to have been served on the other side sometime between 7/30/2016 and 8/22/2016.

    The "Trial Date" is always 10 days AFTER the Entry Day and is always a Thursday. Using this example, the Trial Date would be 9/8/2016.

    The other side must respond 7 days after the Entry Date. This is the Answer Date and is also always a Monday. Note: The Answer Date is also 3 days before the Trial Date.

    I have put together a formula that can calculate all the dates I need to know based on me inputting a possible Entry Date. It will then tell me the Service Period, the Trial Date, and the Answer Date. However, this requires me to first look up on a calendar the next few Mondays and then to, by trial and error, plug in potential Entry Dates to see if I am still in the Service Period window.

    What I would like to know is if it is possible to be able to plug in today's date and have all the potential dates calculated for me. However, the key is that the formula must always account for the fact that the Entry Date must always be on a Monday and that the Service Period must end 7 days before the Entry Date (also on a Monday), and that the end of the Service Period cannot be a date that has already passed. If the end of the service period has already passed, I would like it to move all the dates forward to the following week.

    For example, I would like that if I put in today's date of 8/18/2016, the formula would recognize that the next Monday (8/22/2016) is less than 7 days away (in this case, it's 4 days away) and therefore, Monday 8/22/2016 could not be a valid Entry Date as it would violate the Service Period requirement. Therefore, it would then automatically make Monday 8/29/2016 the Entry Date and base all other dates upon that date.

    Sorry if this is not clear.

    Thank you very much.

  4. hi,

    how can i make a format like this?

    departure , rejoining , "on leave, working"

    12 aug 16 , 2 sep 16 = the excel will only show that " on leave or working

    thank you.

  5. i am handling a tracker and i need the due date column as 20 months from current date.suggest me the formula

  6. Hi Sir, I really need help on my excel. I downloaded an excel report from one of our tracker system tool. I sent it to my costumers and when they received it, the excel contains future dates. I cross checked my excel file but it has no future dates, I really don't know the issue here. Please help me :)

  7. I am making a trial calendar for my law firm. I need to calculate, for example, the date of trial -100 days. They need to be calendar days, not work days, and I have already set up a list of holidays for the next two years. I cannot figure out how to do the formula for the date -100 CALENDAR days, including holidays. Can someone please help me. I have been working on this for days. I have it totally figured out for the dates that need to be WORK DAY, but cannot figure out the ones for calendar days. Any help would be greatly appreciated. NOTE: I am working in Excel 2003.

  8. Hello, can anyone help me what is excel formula if the date will tell it is overdue in: equal or less than 3 months, greater than 3 months, greater than or equal to 6 months?

  9. I want to count the number of cells that are before or after a specified date.

  10. Hello,

    I have two dates in two different cells (A1 = 4/12/1993 and B1 = 04/05/1993) and i want to verify if they fall with the same quarter (89 days). If two dates are within the 89 days, the data "passed" if outside of 89 days, it fails...

    thanks for your help....

  11. Hie is there any formula to track the date occurring in next 2 months?

  12. Hi i need a formula that will check the day is >14, the month is > 7, anfd the year = 16 inserted using the 'TODAY()' function. if the result =TRUE, then insert 500 otherwise enter ""

  13. How about when you are about to get the the formula on what day of the week will your 100th birthday fall?

  14. hi can you help me?

    IF AG3 IS 2 DAYS BEFORE DELIVERY DATE THE RESULT IS "DELIVERY DATE" IF AFTER DELIVERY DATE THE RESULT IS "DONE" WHEN AG3 HAS NO DATE THE RESULT IS "NO SUPPLIER DELIVERY DATE" OTHERWISE "ON GOING

  15. if in cell B1 i have a date 3/23/16 and in cell B2 5/23/16 another date and in cell B3 4/23/16 another.i need to work out if the today's date is 6/23/16 being cell A1, then if cells B1,B2 & B3 is smaller than 30days then put it in cell D8 if they are 31days and less than 60 then put it into D7 and if it is 61 days and less than 90days then put it into D6.

  16. what i need to know is

    12 JULY 16 is todays date.
    18 JULY 16 is the date where i need the follow up.
    i subtracted 12JULY16 - 18JULY16 = 6

    NOW I NEED THIS NUMERIC 6 to get less day by day till the 18TH JULY 16 arrives

    any formula ?

    • Hello Muhammad,

      You can use a formula similar to this:
      =A1-today()

      Where A1 is the follow-up date.

  17. Dear Madam / Sir

    Good Morning..

    How check Average In Caller ( It's A Grade / B Grade )

    Ex..

    Caller Name - XYZ
    Calles Made - 120
    Calls Connective - 70
    Appt - 10
    Turn up -5

    Please Explain Me How to Calculate Caller Average

  18. Hi i just want to know to summarize the value of activity performed as on date today in columns at the start of the table. how can we do ??

    • I would like to prepare data like this with dates on the next columns

      District Total systems Total AMC completed till Yesterday Total AMC completed today 01 02 03 04 05....

  19. My question is i have set of rows having date timestamps across 2013 to 2016. as 01-mar-2014 00:07, 04-Jul-2015 06:40 and so on.. My requirement is I need to extract only Month and Year alone so as to do a pivot on it. It can be done using text as text(A10,"mmm-yyyy"), but a pivot on this data will return the text values not sorted one as Jan-2013,Feb-2013 ... May-2016. If i use date value and then do a pivot on this column, it gives me only list of month not month-year as Jan,Feb,Mar and so on.
    Please help.

    • Let me be clear with the requirement. I need pivot on date field . it should display the values as below
      Jan-2013 30
      Feb-2013 32
      Mar-2013 40
      ...
      Jan-2016 30
      Feb-2016 10
      Mar-2016 02

      Instead of displaying as below
      Jan 60
      Feb 42
      Mar 42

      I dont want to use group function in pivot (Group by Moth,year).Coz i have to do various calculation based on this value.
      Hope you got my requirement.

      • Dear Team,
        I got it. I applied same logic. Converted date to text as text(A10,"mmm-yyyy"). Then took date value. this time it returned with year. After which i applied pivot on it. Now am getting as
        Jan-2013 30
        .
        .
        .
        Mar-2016 02

        Many Thanks.

  20. 1.First thing I need how to show like this "21-jun-16 to 24-jun-16" in a single cell in excel.

    2.Second Thing how I need to calculate the values of between the dates of 21-jun16 to 24- jun-16 which is in another work sheet.

    • Dear Ravi,

      1. To display "21-jun-16 to 24-jun-16", type it out in a cell and click enter.
      I don't think you have expressed your query properly.

      2. To calculate values between dates, use the below formula.
      =Sheet2!A1-Sheet2!B1+1
      Change the cell references as required.
      I have used Cells A1 and B1 of Sheet2 for the dates.

      Vijaykumar Shetye, Goa, India

Post a comment



Thank you for your comment!
When posting a question, please be very clear and concise. This will help us provide a quick and relevant solution to
your query. We cannot guarantee that we will answer every question, but we'll do our best :)