简体   繁体   English

Excel计算两个工作日之间的持续时间

[英]Excel calculate the duration between two weekdays time

计算从文件发布到完成时间的持续时间

Hi, 嗨,

I have this table with me, each record represents one file. 我有这张桌子,每条记录代表一个文件。 My objective is to calculate out the duration for the file to complete. 我的目标是计算出文件完成的持续时间。

I stuck at some files are completed within the same day, while some files might complete only after 1 or 2 or 3 days. 我停留在某些文件在同一天内完成,而某些文件可能仅在1或2或3天后完成。

Are there any formulas to calculate it out? 是否有任何公式可以计算出来?

Thanks. 谢谢。

You are better off with a single date and time column then use something like the below. 您最好在单一的日期和时间列上使用以下内容。 Otherwise combine the date and time yourself first 否则,请先合并日期和时间

=(TIMEVALUE(B2)-TIMEVALUE(C2)+(TIMEVALUE(B2)<TIMEVALUE(C2)))*24

I think I found a way to achieve that. 我想我找到了一种方法来实现这一目标。 Solution

First I would apologize for my unclear question. 首先,我对我不清楚的问题表示歉意。 The weekdays are text format, the weekend doesn't count, and the durations are confirmed within one week period. 工作日为文本格式,不计算周末,并且持续时间在一周内得到确认。

I actually did the below steps and achieved to my objective. 实际上,我执行了以下步骤并实现了我的目标。

  1. Convert all the weekdays to numbers, refer to column J and K. 将所有工作日转换为数字,请参阅列J和K。
  2. Column L is the variance between column J and K. L=KJ L列是J列和K列之间的方差。L = KJ
  3. Then the duration M column put this formula will do. 然后将持续时间M列放入此公式即可。

    =IF(L2=0,MOD(I2-G2,1)*24,IF(AND(L2=1,I2>=G2),MOD(I2-G2,1)*24+L2*24,IF(AND(L2=2,I2>=G2),MOD(I2-G2,1)*24+L2*24,IF(AND(L2=3,I2>=G2),MOD(I2-G2,1)*24+L2*24,MOD(I2-G2,1)*24+(L2-1)*24)))) = IF(L2 = 0,MOD(I2-G2,1)* 24,IF(AND(L2 = 1,I2> = G2),MOD(I2-G2,1)* 24 + L2 * 24,IF(AND (L2 = 2,I2> = G2),MOD(I2-G2,1)* 24 + L2 * 24,IF(AND(L2 = 3,I2> = G2),MOD(I2-G2,1)* 24 + L2 * 24,MOD(I2-G2,1)* 24 +(L2-1)* 24))))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM