DATEDIF and NETWORKDAYS in Google Sheets: date difference in days, months and years (2024)

Today's blog post is all about figuring out the difference between two dates in Google Sheets. You will see lots of DATEDIF formulas to count days, months and years, and learn how NETWORKDAYS is used to count workdays only even if your holidays are based on a custom schedule.

Lots of spreadsheets users find dates confusing, if not extremely difficult, to handle. But believe it or not, there are a few handy and straightforward functions for that purpose. DATEDIF and NETWORKDAYS are a couple of them.

DATEDIF function in Google Sheets

As it happens with functions, their names suggest the action. The same goes for DATEDIF. It must be read as date dif, not dated if, and it stands for date difference. Hence, DATEDIF in Google Sheets calculates the date difference between two dates.

Let's break it down to pieces. The function requires three arguments:

=DATEDIF(start_date, end_date, unit)

  • start_date – a date used as a starting point. It must be one of the following:
    • a date itself in double-quotes: "8/13/2020"
    • a reference to a cell with a date: A2
    • a formula that returns a date: DATE(2020, 8, 13)
    • a number that stands for a particular date and that can be interpreted as a date by Google Sheets, e.g. 44056 represents August 13, 2020.
  • end_date – a date used as an endpoint. It must be of the same format as the start_date.
  • unit – is used to tell the function what difference to return. Here's a full list of units you can use:
    • "D" – (short for days) returns the number of days between two dates.
    • "M" – (months) the number of full months between two dates.
    • "Y" – (years) the number of full years.
    • "MD" – (days ignoring months) the number of days after subtracting whole months.
    • "YD" – (days ignoring years) the number of days after subtracting whole years.
    • "YM" – (months ignoring years) the number of complete months after subtracting full years.

Note. All units must be put to formulas the same way they appear above – in double-quotes.

Now let's piece all these parts together and see how DATEDIF formulas work in Google Sheets.

Calculate days between two dates in Google Sheets

Example 1. Count all days

I have a small table to track some orders. All of them have been shipped in the first half of August – Shipping date – which is going to be my start date. There's also an approximate delivery date – Due date.
DATEDIF and NETWORKDAYS in Google Sheets: date difference in days, months and years (1)

I'm going to calculate days – "D" – between shipping and due dates to see how long it takes for items to arrive. Here is the formula I should use:

=DATEDIF(B2, C2, "D")
DATEDIF and NETWORKDAYS in Google Sheets: date difference in days, months and years (2)

I enter the DATEDIF formula to D2 and then copy it down the column to apply to other rows.

Tip. You can always calculate the entire column at once with a single formula using ARRAYFORMULA:

=ArrayFormula(DATEDIF(B2:B13, C2:C13, "D"))
DATEDIF and NETWORKDAYS in Google Sheets: date difference in days, months and years (3)

Example 2. Count days ignoring months

Imagine there are a few months between two dates:
DATEDIF and NETWORKDAYS in Google Sheets: date difference in days, months and years (4)

How do you count only days as if they belonged to the same month? That's right: by ignoring full months that have passed. DATEDIF calculates this automatically when you use the "MD" unit:

=DATEDIF(A2, B2, "MD")
DATEDIF and NETWORKDAYS in Google Sheets: date difference in days, months and years (5)

The function subtracts elapsed months and counts remaining days.

Example 3. Count days ignoring years

Another unit – "YD" – will aid for when dates have more than a year between them:

=DATEDIF(A2, B2, "YD")
DATEDIF and NETWORKDAYS in Google Sheets: date difference in days, months and years (6)

The formula will subtract years first, and then calculate remaining days as if they belonged to the same year.

Count working days in Google Sheets

There is a special case when you need to count only working days in Google Sheets. DATEDIF formulas won't be much of a help here. And I believe you will agree that subtracting weekends manually is not the most elegant option.

Luckily, Google Sheets has a couple of not-so-magic spells for that :)

Example 1. NETWORKDAYS function

The first one is called NETWORKDAYS. This function calculates the number of working days between two dates excluding weekends (Saturday and Sunday) and even holidays if necessary:

=NETWORKDAYS(start_date, end_date, [holidays])

  • start_date – a date used as a starting point. Required.

    Note. If this date is not a holiday, it is counted as a working day.

  • end_date – a date used as an endpoint. Required.

    Note. If this date is not a holiday, it is counted as a working day.

  • holidays – this one is optional for when you need to point out specific holidays. It must be a range of dates or numbers representing dates.

To illustrate how it works, I will add a list of holidays that take place in-between shipping and due dates:
DATEDIF and NETWORKDAYS in Google Sheets: date difference in days, months and years (7)

So, column B is my start date, columns C – end date. Dates in column E are the holidays to consider. Here is how the formula should look:

=NETWORKDAYS(B2, C2, $E$2:$E$4)
DATEDIF and NETWORKDAYS in Google Sheets: date difference in days, months and years (8)

Tip. If you're going to copy the formula to other cells, use absolute cells references for holidays to avoid errors or incorrect results. Or consider building an array formula instead.

Have you noticed how the number of days decreased compared to the DATEDIF formulas? Because now the function automatically subtracts all Saturdays, Sundays, and two holidays that take place on Friday and Monday.

Note. Unlike DATEDIF in Google Sheets, NETWORKDAYS counts start_day and end_day as workdays unless they are holidays. Hence, D7 returns 1.

Example 2. NETWORKDAYS.INTL for Google Sheets

If you have a custom weekend schedule, you will benefit from another function: NETWORKDAYS.INTL. It lets you count working days in Google Sheets based on personally set weekends:

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

  • start_date – a date used as a starting point. Required.
  • end_date – a date used as an endpoint. Required.

    Note. NETWORKDAYS.INTL in Google Sheets also counts start_day and end_day as workdays unless they are holidays.

  • weekend – this one is optional. If omitted, Saturday and Sunday are considered to be weekends. But you can alter that using two ways:
    • Masks.

      Tip. This way is perfect for when your days off are scattered all over the week.

      Mask is a seven-digit pattern of 1's and 0's. 1 stands for a weekend, 0 for a workday. The first digit in the pattern is always Monday, the last one – Sunday.

      For example, "1100110" means that you work on Wednesday, Thursday, Friday, and Saturday.

      Note. The mask must be put in double-quotes.

    • Numbers.

      Use one-digit numbers (1-7) that denote a pair of set weekends:

      NumberWeekend
      1Saturday, Sunday
      2Sunday, Monday
      3Monday, Tuesday
      4Tuesday, Wednesday
      5Wednesday, Thursday
      6Thursday, Friday
      7Friday, Saturday

      Or work with two-digit numbers (11-17) that denote one day to rest within a week:

      NumberWeekend day
      11Sunday
      12Monday
      13Tuesday
      14Wednesday
      15Thursday
      16Friday
      17Saturday
  • holidays – it is also optional and is used to specify holidays.

This function may seem complicated because of all those numbers, but I encourage you to give it a try.

First, just get a clear understanding of your days off. Let's make it Sunday and Monday. Then, decide on the way to indicate your weekends.

If you go with a mask, it will be like this – 1000001:

=NETWORKDAYS.INTL(B2, C2, "1000001")

But since I have two weekend days in a row, I can use a number from the tables above, 2 in my case:

=NETWORKDAYS.INTL(B2, C2, 2)

Then simply add the last argument – refer to holidays in column E, and the formula is ready:

=NETWORKDAYS.INTL(B2, C2, 2, $E$2:$E$4)
DATEDIF and NETWORKDAYS in Google Sheets: date difference in days, months and years (9)

Google Sheets and date difference in months

Sometimes months matter more than days. If this is true for you and you prefer getting the date difference in months rather than days, let Google Sheets DATEDIF do the job.

Example 1. The number of full months between two dates

The drill is the same: the start_date goes first, followed by the end_date and "M" – that stands for months – as a final argument:

=DATEDIF(A2, B2, "M")
DATEDIF and NETWORKDAYS in Google Sheets: date difference in days, months and years (10)

Tip. Don't forget about the ARRAUFORMULA function that can help you count months on all rows at once:

=ARRAYFORMULA(DATEDIF(A2:A13, B2:B13, "M"))

Example 2. The number of months ignoring years

You may not need to count months throughout all years in-between start and end dates. And DATEDIF lets you do that.

Just use the "YM" unit and the formula will subtract whole years first, and then count the number of months between dates:

=DATEDIF(A2, B2, "YM")
DATEDIF and NETWORKDAYS in Google Sheets: date difference in days, months and years (11)

Calculate years between two dates in Google Sheets

The last (but not least) thing to show you is how Google Sheets DATEDIF calculates the date difference in years.

I'm going to calculate the number of years couples have been married based on their wedding dates and today's date:
DATEDIF and NETWORKDAYS in Google Sheets: date difference in days, months and years (12)

As you may have already guessed, I will use the "Y" unit for that:

=DATEDIF(A2, B2, "Y")
DATEDIF and NETWORKDAYS in Google Sheets: date difference in days, months and years (13)

All these DATEDIF formulas are the first to try when it comes to calculating days, months, and years between two dates in Google Sheets.

If your case can't be solved by these or if you have any questions, I encourage you to share them with us in the comments section below.

You may also be interested in

  • Calculating time in Google Sheets: subtract, sum and extract date and time units
  • Date and time in Google Sheets: enter, format and convert dates and time in your sheet
  • How to change Google Sheets date format and convert dates to numbers and text
DATEDIF and NETWORKDAYS in Google Sheets: date difference in days, months and years (2024)
Top Articles
Read "On Being a Scientist: Vietnamese Version" at NAP.edu
Định hướng Chiến lược biển Việt Nam đến năm 2020 | KOYO
7 Verification of Employment Letter Templates - HR University
Bashas Elearning
Team 1 Elite Club Invite
T Mobile Rival Crossword Clue
Here are all the MTV VMA winners, even the awards they announced during the ads
Aiken County government, school officials promote penny tax in North Augusta
Www Thechristhospital Billpay
41 annonces BMW Z3 occasion - ParuVendu.fr
Midway Antique Mall Consignor Access
Sitcoms Online Message Board
Helloid Worthington Login
4302024447
Connexus Outage Map
Hartford Healthcare Employee Tools
Washington Poe en Tilly Bradshaw 1 - Brandoffer, M.W. Craven | 9789024594917 | Boeken | bol
Niche Crime Rate
De beste uitvaartdiensten die goede rituele diensten aanbieden voor de laatste rituelen
U Arizona Phonebook
Craigslistjaxfl
Craigslist Sparta Nj
Kayky Fifa 22 Potential
Loft Stores Near Me
Mychart Anmed Health Login
Zack Fairhurst Snapchat
Busted News Bowie County
Reser Funeral Home Obituaries
Aspenx2 Newburyport
Hdmovie2 Sbs
Is Henry Dicarlo Leaving Ktla
Stickley Furniture
Generator Supercenter Heartland
10 Best Quotes From Venom (2018)
Why comparing against exchange rates from Google is wrong
R/Mp5
Allegheny Clinic Primary Care North
Parent Management Training (PMT) Worksheet | HappierTHERAPY
What are the 7 Types of Communication with Examples
Persona 4 Golden Taotie Fusion Calculator
Asian Grocery Williamsburg Va
Games R Us Dallas
Pitchfork's Top 200 of the 2010s: 50-1 (clips)
Wattengel Funeral Home Meadow Drive
Ukraine-Krieg - Militärexperte: "Momentum bei den Russen"
Weather Underground Cedar Rapids
Coroner Photos Timothy Treadwell
The Great Brian Last
Cars & Trucks near Old Forge, PA - craigslist
Lake County Fl Trash Pickup Schedule
Palmyra Authentic Mediterranean Cuisine مطعم أبو سمرة
Booked On The Bayou Houma 2023
Latest Posts
Article information

Author: Arline Emard IV

Last Updated:

Views: 6241

Rating: 4.1 / 5 (72 voted)

Reviews: 87% of readers found this page helpful

Author information

Name: Arline Emard IV

Birthday: 1996-07-10

Address: 8912 Hintz Shore, West Louie, AZ 69363-0747

Phone: +13454700762376

Job: Administration Technician

Hobby: Paintball, Horseback riding, Cycling, Running, Macrame, Playing musical instruments, Soapmaking

Introduction: My name is Arline Emard IV, I am a cheerful, gorgeous, colorful, joyous, excited, super, inquisitive person who loves writing and wants to share my knowledge and understanding with you.