Forum Discussion
NeilKloster
Dec 28, 2022Brass Contributor
calculate total hours between date/time (excluding weekends)
Hello, I know that this is pretty easy for this group, but it's escaping me at the moment. I want to calculate the hours between two fields, but I just want a simple number of hours. No concat...
- Dec 29, 2022
NeilKloster So there are 2 things happening here:
a) any of the lines with start and end being the same day are 0 because you missed the last line of the equation
b) the numbers look weird because you didn't format them to show [h]:mm
If you want purely hours (i.e. [h]:mm of 1:30 would be 1.5) then just add 24* at the beginning (or *24 at the end) of the equation.
see attached.
HansVogelaar
Dec 29, 2022MVP
A shorter formula that works if neither Date/Time Opened not Date/Time Closed will be a weekend day:
=IF(OR(A2:B2=""),"",16*(NETWORKDAYS(A2,B2)-1)+24*(MOD(B2,1)-MOD(A2,1)))
NeilKloster
Dec 30, 2022Brass Contributor
Haha!! This is also works EXACTLY like the other one too - I just checked them both. Thank you so much!! Much appreciated everyone!