Answers.Body: <p>Make three text layers with a slider on each.  Call the layers <strong>value 1</strong>, <strong>value 2</strong>, and <strong>value 3</strong>.</p>
  <p>In the source text of each of the text layers put this expression, to display the slider value and round it to the nearest minute:</p>
  <pre><code>slider = (effect(&quot;Slider Control&quot;)(&quot;Slider&quot;).value);
  rounding = (Math.round(slider));
  SourceText = rounding + &quot; minutes&quot;
  </code></pre>
  <p>Make a text layer called <strong>total</strong>.</p>
  <p>Put the following in its source text as an expression</p>
  <pre><code>totalmins = thisComp.layer(&quot;value 1&quot;).effect(&quot;Slider Control&quot;)(&quot;Slider&quot;) + thisComp.layer(&quot;value 2&quot;).effect(&quot;Slider Control&quot;)(&quot;Slider&quot;) + thisComp.layer(&quot;value 3&quot;).effect(&quot;Slider Control&quot;)(&quot;Slider&quot;)
  
  if (totalmins &lt;60) {
      SourceText = totalmins + &quot; minutes&quot; } else
          if (totalmins &gt; 61) {
          SourceText = Math.round((totalmins/60)*10)/10 + &quot; hours&quot; } 
          else
          &quot;1 hour&quot;
  </code></pre>
  <p><strong>totalmins</strong> is a variable which adds up the total minutes from the sliders in the other layers.</p>
  <p>If the total is under 60 minutes, it displays the total in minutes with the text &quot; minutes&quot; appended to it.</p>
  <p>If the total is over 61 minutes, it displays the total time in hours, to one decimal place (the <strong>Math.round</strong> function normally rounds to the nearest whole number, so confusingly we have to multiply it by 10, then divide by 10 outside it to get one decimal place). Watch out for the capital letter on &quot;Math&quot;.</p>
  <p>Otherwise, display &quot;1 hour&quot;.</p>
  <p><a href="https://i.sstatic.net/sKC2h.gif" rel="nofollow noreferrer"><img src="https://i.sstatic.net/sKC2h.gif" alt="screegrab" /></a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-11-16T14:24:20.953Z
Answers.Text: Wow, this is great! Thank you so much! I just had an issue, the total wasn't rounding up from 0 to 60m but only after, so I added math.round after totalmins.
Answers.UserDisplayName: Apeiron_Sound
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-11-16T13:23:29.590Z
Answers.LastActivityDate: 2021-11-16T22:58:56.700Z
Answers.LastEditDate: 2021-11-16T22:58:56.700Z
Answers.UserDisplayName: tomh
Body: <p>I'm trying to create an <strong>expression that changes source text from minutes to hours.</strong></p>
  <p>Here is an example of the graphic I'm animating:</p>
  <p><a href="https://i.sstatic.net/r7is0.gif" rel="nofollow noreferrer"><img src="https://i.sstatic.net/r7is0.gif" alt="animation snippet" /></a></p>
  <p>As you can see the 3 hours counter is on hold, <strong>I want that to start from 0 minutes and increase till 60 to then swap to hours and gradually reach 3</strong>.</p>
  <p>I will apply that too on the blue bar which currently displays <em>'60 min'</em> instead of <em>'1 hour'</em>.
  Of course, I can work around it but I'd love to know a working expression.</p>
  <p>Thanks!</p>
  
Tags: <after-effects><animation><adobe><after-effects-expressions><motion>
Title: AE Counter Switch (Mins > Hs)
UserDisplayName: Apeiron_Sound
ThreadText: # AE Counter Switch (Mins > Hs)
  
  (Asked by: username_0 on 2021-11-16)
  
  I'm trying to create an **expression that changes source text from minutes to hours.**
  
  Here is an example of the graphic I'm animating:
  
  [![animation snippet](https://i.sstatic.net/r7is0.gif)](https://i.sstatic.net/r7is0.gif)
  
  As you can see the 3 hours counter is on hold, **I want that to start from 0 minutes and increase till 60 to then swap to hours and gradually reach 3**.
  
  I will apply that too on the blue bar which currently displays *'60 min'* instead of *'1 hour'*.
  Of course, I can work around it but I'd love to know a working expression.
  
  Thanks!
  
  **Tags:** after-effects, animation, adobe, after-effects-expressions, motion
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-11-16. Score: 3 | Accepted answer
  
  Make three text layers with a slider on each. Call the layers **value 1**, **value 2**, and **value 3**.
  
  In the source text of each of the text layers put this expression, to display the slider value and round it to the nearest minute:
  
  ```
  slider = (effect("Slider Control")("Slider").value);
  rounding = (Math.round(slider));
  SourceText = rounding + " minutes"
  
  ```
  
  Make a text layer called **total**.
  
  Put the following in its source text as an expression
  
  ```
  totalmins = thisComp.layer("value 1").effect("Slider Control")("Slider") + thisComp.layer("value 2").effect("Slider Control")("Slider") + thisComp.layer("value 3").effect("Slider Control")("Slider")
  
  if (totalmins <60) {
      SourceText = totalmins + " minutes" } else
          if (totalmins > 61) {
          SourceText = Math.round((totalmins/60)*10)/10 + " hours" } 
          else
          "1 hour"
  
  ```
  
  **totalmins** is a variable which adds up the total minutes from the sliders in the other layers.
  
  If the total is under 60 minutes, it displays the total in minutes with the text " minutes" appended to it.
  
  If the total is over 61 minutes, it displays the total time in hours, to one decimal place (the **Math.round** function normally rounds to the nearest whole number, so confusingly we have to multiply it by 10, then divide by 10 outside it to get one decimal place). Watch out for the capital letter on "Math".
  
  Otherwise, display "1 hour".
  
  [![screegrab](https://i.sstatic.net/sKC2h.gif)](https://i.sstatic.net/sKC2h.gif)
  
  > **Comments:**
  > **username_0**: Wow, this is great! Thank you so much! I just had an issue, the total wasn't rounding up from 0 to 60m but only after, so I added math.round after totalmins.  
  
  ---
  
  