提示:其它语言是由 Google 机器翻译的。 你可以访问 English 版本。
登录
x
or
x
x
马上登记
x

or

如何计算Excel中两个日期之间的天数/工作日/周末数?

你是否曾经需要计算Excel中两个日期之间的天数? 可能有时候,你只是想计算两个日期之间的工作日,有时候,你只需要计算两个日期之间的周末日。 你怎么能够计算在特定条件下两个日期之间的天数?

计数/计算两个日期之间的天数

计算/使用公式计算两个日期之间的工作日数

计算/使用公式计算两个日期之间的周末天数

使用Kutools for Excel计算/计算两个日期之间的工作日/周末数


添加年数/月/日/周至今:

Kutools for Excel公式 实用程序包含一些常用公式,例如添加日期,基于生日计算年龄等。 用这些通常的公式,你可以很快得到你想要的结果,而不用记住任何公式。

doc添加日期到1日期

Kutools for Excel:比200方便的Excel加载项,可以在60天免费试用。 下载并免费试用现在!


计数/计算两个日期之间的天数


假设今天是3 / 18 / 2017,那么您的假期从11 / 21 / 2016开始,如下面的截图所示,并且您想要计算这两个日期之间有多少天。

doc计算天数1

在空白单元格中,请输入此公式 = B2-B1,然后按 输入 键,你会得到两个日期之间的天数。 看截图:

doc计算天数2

注意:在上面的公式中, B2 吸引最终数据,并且 B1 indacates的开始日期。 您可以根据需要更换它们。


计算/使用公式计算两个日期之间的工作日数

但有时候,你只是想知道工作日的数量(从星期一到星期五),上面的公式不适合你。 在这种情况下,这里有两个函数可以帮助你处理这个问题。

1。 使用NETWORKDAYS函数来计算工作日的数量

在空白单元格中,请输入此公式 = NETWORKDAYS(B1,B2)B1 代表开始日期和 B2 表示结束日期)然后键入 输入 键,您将计算两个日期之间的周日和周六的工作日数量。 看截图:

doc计算天数3

请注意:

有时候,这两天可能会有一些假期,如果你想计算这两天之间的工作日,你应该排除星期六,星期天和假日。 这个 NETWORKDAYS 功能也可以帮助你。

该语法 NETWORKDAYS 功能是: = NETWORKDAYS(开始日期,结束日期,假期)

将假期日期输入到要从日期中减去的单元格中,然后输入此公式 = NETWORKDAYS(B1,B2,B3:E3)B1 表示开始日期, B2 代表结束日期和 B3:E3 是假期列表),然后按 输入 键,计算了不包括周日,周六和节假日的工作日数。

doc计算天数4

2。 使用SUM和INT函数来计算工作日的数量

除NETWORKDAYS函数外,还有另一个公式可以帮助您获取两个日期之间的工作日数量。

在空白单元格中输入此公式 =SUM(INT((WEEKDAY(B1-{2,3,4,5,6})+B2-B1)/7)),然后点击 输入 关键,并且所有的工作日将被计算。 看截图:

doc计算天数5

备注:

1。 有时候,你每星期有6个工作日(从星期一到星期六),所以你需要计算包括周六在内的工作日的数量,但不包括周日。 在这种情况下,您可以应用此公式 =SUM(INT((WEEKDAY(B1-{2,3,4,5,6,7})+B2-B1)/7)).

2。 在上面的公式中, B1 代表开始日期和 B2 表示结束日期。


计算/使用公式计算两个日期之间的周末天数

这里也有一些公式来计算给定期间内的周末天数(周六和周日)。

键入此公式 =SUM(INT((WEEKDAY(B1-{1,7})+B2-B1)/7)) (B1 表示开始日期, B2 代表结束日期)放入空白单元格中,然后按 输入 关键,现在你会得到这两个日期之间的周末。 看截图:

doc计算天数6

请注意: 另一个公式来介绍您计算给定两个日期的周末。 请申请这个 = SUMPRODUCT( - (WEEKDAY(ROW(INDIRECT(B1& “:” &B2)),2)> 5)) (B1 表示开始日期和 B2 代表结束日期)。


使用Kutools for Excel计算/计算两个日期之间的工作日/周末数

计算/计算两个日期之间的工作日/周末/特定日期的数量

要计算两个给定日期之间的平日或周末数量, Kutools for Excel公式 包含一些常用公式的实用程序,您可以将它们应用于计算年龄,出现单词等。

doc计算天数7

Kutools for Excel:比200方便的Excel加载项,可以在60天免费试用。 下载并免费试用现在!


演示:使用Kutools for Excel计算/计算两个日期之间的周末/周日/特定工作日的数量

Kutools for Excel:比200方便的Excel加载项,可以在60天免费试用。 下载并免费试用现在!


相关文章:

如何统计Excel中两个日期之间的特定工作日数量?


Kutools for Excel - 最佳办公生产力工具提高80%的生产力

  • 重用: 快速插入 复杂的公式,图表 以及你以前用过的任何东西; 加密单元格 密码; 创建邮件列表 并发送电子邮件...
  • 超级方程式酒吧 (轻松编辑多行文字和公式); 阅读布局 (轻松读取和编辑大量单元格); 粘贴到过滤范围...
  • 合并单元格/行/列 不丢失数据; 分裂细胞含量; 组合重复的行/列...防止重复的细胞; 比较范围...
  • 选择复制或唯一 行; 选择空行 (所有细胞都是空的); 超级查找和模糊查找 在许多工作簿中; 随机选择......
  • 精确复制 多个单元格而不更改公式参考; 自动创建参考 多张表; 插入项目符号,复选框等等......
  • 提取文本,添加文本,按位置删除, 删除空间; 创建和打印分页小计; 在单元格内容和注释之间转换...
  • 超级过滤器 (将过滤方案保存并应用到其他工作表); 高级排序 按月/周/日,频率等; 特殊过滤器 用粗体,斜体......
  • 结合工作簿和工作表; 根据键列合并表; 将数据拆分为多个表格; 批量转换xls,xlsx和PDF...
  • 超过300强大的功能。 支持Office / Excel 2007-2019和365。 支持所有语言。 在您的企业或组织中轻松部署。 全功能60天免费试用。
kte tab 201905

Office选项卡为Office提供选项卡式界面,使您的工作更轻松

  • 在Word,Excel,PowerPoint中启用选项卡式编辑和阅读,Publisher,Access,Visio和Project。
  • 在同一窗口的新选项卡中打开并创建多个文档,而不是在新窗口中。
  • 通过50%提高您的工作效率,每天为您减少数百次鼠标点击!
官方底部
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    cb · 1 months ago
    What about about adding days from a date, for example: 3/4/19 then add 60 days to get a new date.
    • To post as a guest, your comment is unpublished.
      skyyang · 1 months ago
      Hello,

      To add some days to a date, you just need to add the days to the date directly as below formula:
      =A1+60
      Please try it, hope it can help you!
  • To post as a guest, your comment is unpublished.
    shah179 · 6 months ago
    HI,
    need formula for calculate the days for working days (monday,tuesday, wednesday, thursday and Saturday) - minus holidays. (weekends is friday and sunday)

    pls help.
  • To post as a guest, your comment is unpublished.
    Jamirulhairi · 10 months ago
    Offday Friday and Saturday
    Public Holiday 22/08/18, 23/08/2018
    Manual count for working day are 20 days.
    =SUM(INT((WEEKDAY(L3-{1,2,3,4,5})+L5-L3)/7)) --->Total working day 22
    =NETWORKDAYS(L14,L16,L18:BS19) -->Total working days 21

    Please help
  • To post as a guest, your comment is unpublished.
    Luis · 10 months ago
    Hi i need an excel formula which calculates the number of days between two dates and will give me a warning if the count is past day 28. Also if day 28 falls on a weekend or public holiday then the formula needs to account for this so day 28 becomes the next business day.
  • To post as a guest, your comment is unpublished.
    Manoj · 1 years ago
    Hi,
    I need to compute the no. of days by month wise between the dates excluding weekends and holidays. Can you please help to derive that
    From 01-01-2018
    To 05-03-2018
    Holidays 15-01-2018 26-01-2018 10-02-2018 04-03-2018
    No. of days in JAN = ?
    No. of days in FEB = ?
    No. of days in MAR = ?
    • To post as a guest, your comment is unpublished.
      skyyang · 1 years ago
      Hello, Manoj
      May be there is not a direct formula for solving your problem, but, you can set the data as following screenshot shown, and then apply this formula:
      =NETWORKDAYS(A2,B2,$D$2:$D$5)
      Please try it, hope it can help you!
      • To post as a guest, your comment is unpublished.
        Manoj · 1 years ago
        Hi Skyyang,
        I have huge data to compute and between two long period dates. Can you please help to compute with the two different month range date.
        Thanks.
      • To post as a guest, your comment is unpublished.
        Manoj · 1 years ago
        Hi Skyyang,
        In your explanation, start date and end date are from same month. But I need to know how to compute, if start date and end date are different month. For Ex: START date: 1 Jan 2018 to END date: 31 Mar 2018. I want to find the days by month wise.
        • To post as a guest, your comment is unpublished.
          Nishant · 8 months ago
          Hi Majoj, did you get an answer to this? I have been trying to figure this out myself too!
  • To post as a guest, your comment is unpublished.
    Mahbub · 1 years ago
    Hello,


    If there are some many days and some days are double or triple then how we can count the number of days between bigger and smaller days (removing duplicate days)
  • To post as a guest, your comment is unpublished.
    Sandip Trivedi · 1 years ago
    Hello, today is 17.06.2018 and past date is 05.04.2018 than how many days in beetwin both dates? How to calculate in excel by mentioning only dates.
    • To post as a guest, your comment is unpublished.
      skyyang · 1 years ago
      Hello, Trivedi,
      Your date is not real date format, you should convert them to normal date format, and then apply the above formula in this article.

      If you don't know how to convert them to date, you can apply a feature Convert to date of Kutools for Excel as following screenshot shown:
  • To post as a guest, your comment is unpublished.
    Ravi · 1 years ago
    Hi,

    How we find the ending date ,using the Stating Date and .duration is 10.06 i.e YY.MM

    For example:

    22.01.2018 is the starting date , what would be the ending date after 10.06(10Years . 6 month.).

    Can you suggest us the formula.
    • To post as a guest, your comment is unpublished.
      skyyang · 1 years ago
      Hello, Ravi, may be the following formula can help you:
      =DATE(YEAR(A2)+10,MONTH(A2)+6,DAY(A2))
      in this formula, 10 is the number of year, 6 is the number of month.
      Please try it, thank you!
  • To post as a guest, your comment is unpublished.
    Paata · 1 years ago
    hi, need to calculate number of days. given only one date. for exmp.: 02.02.2017 is a 32-nd day in 2017. what kind of formula can calculate this?
  • To post as a guest, your comment is unpublished.
    Ibrar · 1 years ago
    hi
    i have a checkin and check out dates, i want to calculate how many Thurs+Fridays are as they have different room rates to the rest of the nights , ie from Sat to Wednesday
  • To post as a guest, your comment is unpublished.
    Bittu Gogoi · 2 years ago
    Hi,
    I want to find no of days between 2 dates without sundays. Please help me out.
    Thanks,
    Bittu Gogoi
  • To post as a guest, your comment is unpublished.
    Rajesh Sinha · 2 years ago
    Alternative formula to avoid weekends is quite useful.
  • To post as a guest, your comment is unpublished.
    Hayim Y. Sheynin · 2 years ago
    I need to display the days of the week for 28 year cycle, let say from January 1, 1 CE to January 1, 2 CE in Julian calendar. Is it possible to make it automatically?

    Waiting for answer, sincerely, Hayim
  • To post as a guest, your comment is unpublished.
    Renjith · 2 years ago
    Hi,

    Please provide a simple formula, i want to add days in a particular date. for example 10.05.2017 and want to add 10 days so answer should come 20.05.2017
    • To post as a guest, your comment is unpublished.
      Joshua · 1 years ago
      A1= 10-05-2017
      B1= A1+10
      = 20-05-2017


      *note A1 need to be in date format and B1 in General format
  • To post as a guest, your comment is unpublished.
    Jignesh · 2 years ago
    Hi,

    Please provide the formula which include two conditions. If the deference between the two dates are "0 to 5" calendar days than the final result is "Y" and if the deference between the two dates are "greater than 5" or "less than 0" than final result is "N".
    15-Jan-2017, 17-Jan-2017 = Y
    15-Jan-2017, 21-Jan-2017 = N
    15-Jan-2017, 11-Jan-2017 = N
    15-Jan-2017, 15-Jan-2017 = Y
  • To post as a guest, your comment is unpublished.
    Krishna · 2 years ago
    Hi..

    I need your help to get Network days with 2 conditions.

    Start date ; 01/11/2016 and End date:13/11/2016

    Holidays (01/11/2016 and 02/11/2016).

    1.Excluded Sundays.
    2.Excluded given above Holidays.

    Thanks,
    Krishna M
    • To post as a guest, your comment is unpublished.
      Sony Kadanthodan Seb · 1 years ago
      A B C D E
      01-11-2016 13-11-2016 9 01-11-2016 02-11-2016

      (SUM(INT((WEEKDAY(A2-{2,3,4,5,6,7})+B2-A2)/7))-((NETWORKDAYS(A2,B2)-(NETWORKDAYS(A2,B2,D2:E2)))))
  • To post as a guest, your comment is unpublished.
    JACKSON · 2 years ago
    HI..

    How to count today date add to after 60days which date. Ex:27-10-2016 +60days = which Date?
  • To post as a guest, your comment is unpublished.
    Jun Hao · 3 years ago
    Hi,

    I need to calculate the downtime to uptime of a machine in minutes during working hours.

    My working hours are :
    Monday - Friday 6:00 AM - 7:00 PM
    Saturday 7:00 AM - 2:00 PM
    Sundays and Holidays not included

    For example it's from 10/05/16 (Tuesday) 6:00 PM to 11/05/16 (Wednesday) 8:00 AM, it should only be calculated at 180mins (3 hours) as the downtime will stop on Tuesday 7:00 PM and resume at Wednesday 6:00 AM.
  • To post as a guest, your comment is unpublished.
    Walid · 3 years ago
    Hello,
    I need to calculate the difference between two dates for example start on 04/05/2016, and it will end on 20/06/2016, but actually i need one formula calculate to display each month separate " days took in May 24 and on June 20.
  • To post as a guest, your comment is unpublished.
    Latheef · 3 years ago
    I need to calculate storage based on days (0-10); per day days 10 onwards?
    for exapmle: today's date (03/03/2016) + 10 days = date should come automatically????
  • To post as a guest, your comment is unpublished.
    Cindy Wyman · 3 years ago
    I am trying to calculate the number of days between dates but there are some cells where the 1st date may be blank. I want to return a "0" in that cell when that occurs. I've tried adding an IF formula, but can't get it right. Is there a way I can either ignore the blank cell and not return a value or just have a "0" in the cell?
  • To post as a guest, your comment is unpublished.
    Dhruv Patel · 4 years ago
    I Need to find days in M S excel? can't find by Me give me equation......
  • To post as a guest, your comment is unpublished.
    Mark Donelly · 4 years ago
    I need to calculate storage based on days (0-7); days (8-14) and per day days 15 onwards? What formulas do i use?
  • To post as a guest, your comment is unpublished.
    Philip Hudnott · 4 years ago
    I need to calculate the number of days between 2 dates including 1st and last day, and split it into the number of days in each month.
    E.g. start 28 Jan end 3 march would return Jan = 4, Feb = 28, Mar = 3
    how can I do this?
  • To post as a guest, your comment is unpublished.
    Eve · 4 years ago
    I would like to get formula which can count 6 work days excluding holidays & certain day is consider half days.

    Is there any formula that can help?

    thank you
  • To post as a guest, your comment is unpublished.
    Portia · 4 years ago
    I HAVE FOUR DIFFERENT DATES AND I NEED TO COUNT THE DIFFERENCE BETWEEN THEM WHICH FUNCTION SHOULD I USE AND HOW??
  • To post as a guest, your comment is unpublished.
    S. M. · 5 years ago
    Using a column list containing the date and time in this format DD/MM/YYYY HH:MM ; what formula(s) would be needed to count how many times each day, and each hour that a cell is entered into this list
  • To post as a guest, your comment is unpublished.
    Amby · 5 years ago
    Hello.
    I am using Method2, but I want to get the - Fridays, Saturdays, and Sundays. However, in the following case, start day: Saturday, end day: Sunday, I get only 1 day instread of 2.
    Would anyone be able to help in the same?

    Many thanks,
    • To post as a guest, your comment is unpublished.
      AJM · 5 years ago
      Works for me - did you remember to modify the array to refer to the required days? You would need to modify it to {1,6,7} rather than {2,3,4,5,6}
  • To post as a guest, your comment is unpublished.
    NAJWA · 5 years ago
    Good evening
    Kindly my inquiry if I have in one cell in excel date and need to extract the number of days, i.e., 13-31/07/2014 is it possible ?
    thank you
    Najwa
    • To post as a guest, your comment is unpublished.
      admin-jay · 5 years ago
      Hello, Please be more specific about your issue.

      To extract all days between 13/07/2014 and 31//07/2014?