I have TimeValue() operating on some strings and then I add the values up. Then I need something that does this pseudocode:
If(total>"40 hours",this,that other thing)
Here's the problem: how do I test for "greater than 40 hours"?
TimeValue() only works for times between 0 hours and 24 hours. Anything more and it acts like a modulus and just loops around again. So TimeValue("40:00") gives the same result as TimeValue("16:00").
DateValue() basically has an embedded RoundDown() function. DateValue("40:00") gives "1" (because it's less than 48 hours or two days) while DateValue("50:00") gives "2" (because it's more than 48 hours but less than 72 hours).
I suppose I could do something like:
=If(total>(TimeValue("20:00")*2),this,that other thing) or
=If(total>(TimeValue("20:00")+TimeValue("20:00")),this,that other thing) -- these are the same thing, just one might be more readable at a glance
But that seems really clunky. Isn't there anything in between DateValue() and TimeValue(), something that will convert a time greater than 24 hours, but for which I don't want to round to complete days?
Bookmarks