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

or

如何计算Excel中午夜之后的时间?

doc计算过夜1的时间

假设您有时间表来记录您的工作时间,则A列中的时间是今天的开始时间,B列中的时间是下一天的结束时间。 通常情况下,如果通过直接减去“= B2-A2”来计算两次之间的时间差,它将不会显示正确的结果,如左侧所示。 你怎样才能正确计算Excel中午夜后的两个小时?

用公式计算午夜后的两次小时


添加一些年/月/日/周/小时/分钟/秒的日期:

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

DOC-数周,二,dates3

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


箭头蓝色右泡 用公式计算午夜后的两次小时


要在午夜两次之间得到正确的计算结果,可以应用以下公式:

1。 输入这个公式: =(B2-A2+(B2<A2))*24 (A2 是更早的时候, B2 是更晚的时候,您可以根据需要将它们更改为空白单元格,其中包含时间数据旁边的截图:

doc计算过夜2的时间

2。 然后将填充手柄拖动到要填充此公式的单元格,并且一次计算出午夜之后两次之间的时差,请参阅截图:

doc计算过夜3的时间


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.
    chris · 1 months ago
    Hi, i need help please. I have data that auto loads daily at 5pm. The process is broken into 2 parts (ETL1 and ETL2). ETL1 starts at 5pm till 11pm and ETL2 starts at 11 till 4 am. at 7 am i run a script to check if everything ran. each row has a start and end date time. i would like to flag all data after 5pm yesterday as todays data. Currently when i filter on today, i only see the rows where the date is after 00:00
  • To post as a guest, your comment is unpublished.
    Alan Crookes · 5 months ago
    Can someone explain when the function of addition of the TRUE/FALSE values does so I can understand the formula please?
  • To post as a guest, your comment is unpublished.
    Clifton · 5 months ago
    I think a simple MOD(B2-A2,1) should be enough?
  • To post as a guest, your comment is unpublished.
    Matt · 1 years ago
    Austin, the formula stated in the article above works well for me
  • To post as a guest, your comment is unpublished.
    Austin Bond · 1 years ago
    The formula under bullet point #1 is wrong. =(B2-A2+(B2<A2))*24, but is should read as =B2-A2+(B2<A2)*24.

    The parentheses are in the wrong spot.
    • To post as a guest, your comment is unpublished.
      NoName · 10 months ago
      THANK YOU! This is definitely the correct formula.
    • To post as a guest, your comment is unpublished.
      Axel Bak · 1 years ago
      Yes Austin! Your formula works, the other formula renders nonsense (in my case). Thanks!!
    • To post as a guest, your comment is unpublished.
      Lisa · 1 years ago
      No, Austin's correction works for me. The original with the parentheses where they are shown does not work. Maybe a diifferent version of Excel makes a difference? I am on MS Home and Office 2016
    • To post as a guest, your comment is unpublished.
      Greg · 1 years ago
      The original formula works better than your suggestion Austin.
      I also used =(A2-B2+(A2<B2))*1440
      This worked best to convert time into minutes.
      • To post as a guest, your comment is unpublished.
        Ângelo Campos · 7 months ago
        Depois de colocar a formatação ao tentar somar a coluna total de horas o valor dá-me errado.

        O campo é formatado [h]mm
        • To post as a guest, your comment is unpublished.
          fabio · 5 months ago
          =(A2-B2+(A2)) sem utilizar a multiplicação por 24