2 Replies Latest reply on Jul 18, 2015 6:23 PM by philmodjunk

# Hours and minutes... Calculation scenarios

### Title

Hours and minutes... Calculation scenarios

### Post

Hi all, I have a calculation below that is part of a calculation field description of an artwork. if the artwork is a video the user enters the duration in hours, minutes and seconds. Obviously sometimes a video might be over an hour, might just be minutes and seconds, or might just be seconds. I have got as far as the below. Which is pretty close.

However, when the hours is "1" the calculation is not returning a result. Over two hours is fine. Should make sense below..

Any ideas? thank you

If (Hours >1 ; Hours & " Hours" &  " : " &  (If (Hours = "1" ; Hours & " Hour" ) & If (not IsEmpty (Minutes) ; Minutes & " Minutes" & " : ") & Seconds & " Seconds") ;

• ###### 1. Re: Hours and minutes... Calculation scenarios

Have also tried -

If (Hours  ≠ 1 ; Hours & " Hours" &  " : "  &  If (not IsEmpty (Minutes) ; Minutes & " Minutes" & " : ") & Seconds & " Seconds") ;

no luck...

• ###### 2. Re: Hours and minutes... Calculation scenarios

Make sure that Hours, Minutes and Seconds fields are fields of type number. That may be why a value of 1 hour is not returning any result.

I'd use a calculation such as:

Substitute (
List (

Case ( Hours = 1 ; Hours &  " Hour"  ;
Hours > 0 ; Hours & " Hours"
) ;
Case (Minutes = 1 ; Minutes & " Minute" ;
Minutes > 0 : Minutes & " Minutes"
) ;
Case ( Seconds > 0 ; Seconds & " Seconds" )
) // List

; ¶ ; ":" ) // Substitute