简体   繁体   中英

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. (A1 contains in-time and A2 contains out-time). 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'. I have figured out to get the total time by using the formula below (with formatting cell as hh:mm):

=ABS(Sheet1!A1-Sheet1!A2)

Now I would like to avoid getting #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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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