简体   繁体   English

MS Excel:编写公式以计算平均时间

[英]MS Excel: Writing formula to calculate the average time

I have a sheet with in-time and out-time recorded in 24 hour time format. 我有一张以24小时时间格式记录的进场时间和出场时间的工作表。 (A1 contains in-time and A2 contains out-time). (A1包含时间,A2包含时间)。 The in-time and out-time are provided for all dates in a month. 提供一个月中所有日期的进班时间和出班时间。 So some of the cells contain text, like in case of holidays, the cell contains 'H' and in case of weekends, the cell contains either 'SAT' or 'SUN'. 因此,某些单元格包含文本,例如在假期的情况下,该单元格包含“ H”,在周末的情况下,该单元格包含“ SAT”或“ SUN”。 I have figured out to get the total time by using the formula below (with formatting cell as hh:mm): 我想通了使用以下公式(将单元格的格式设置为hh:mm)来获取总时间:

=ABS(Sheet1!A1-Sheet1!A2) = ABS(Sheet1!A1-Sheet1!A2)

Now I would like to avoid getting #VALUE! 现在,我想避免获得#VALUE! errors for the holidays and weekends and calculate the average total time. 假期和周末的误差,并计算平均总时间。

Can someone help? 有人可以帮忙吗? Below is a sample data that shows cells containing total time and text. 下面是一个示例数据,显示了包含总时间和文本的单元格。

Dates     1     2     3      4      5     6    ...           AVG
ABC1      H   4.00  12.00   7.45   SAT   SUN   ...        <avg time>
ABC2      H   8.00  13.00   8.45   SAT   SUN   ...        <avg time>

Thanks. 谢谢。

您可以使用ISNUMBER()函数仅考虑时间而忽略字母: http : //www.techonthenet.com/excel/formulas/isnumber.php

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

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