ShowAll Questionssorted byDate Posted
lapaul

# How to calculate total minutes into hours

Hi,

Is there any formula to convert or calculate total minutes into hours? I have a custom field that stores

total minutes and I want to convert this into hours. Any help would be appreciated.

thanks

Paul

werewolf

Uhhh....

Minutes/60?

ThomasTT

I really envy your sense of humor, werewolf.

ThomasTT

Message Edited by ThomasTT on 09-30-2009 10:39 PM
KimberlyJ

I placed a custom number field in Activities.  It is called Activity Duration in Minutes.  When I run a report, I get the sum of all the minutes at the bottom.  I would like it to be displayed as hours and minutes.  I tried the formula below and I keep getting errors, (I got this out of SFDC help and training).  Is this formula supposed to go someplace else? Or, am I doing it wrong?

Thanks.

Kimberly J.

FLOOR((Activity.Activity_Duration__c:SUM)/60)

&"Hour(s)"

&MOD((Activity.Activity_Duration__c:SUM)/60,1)*60

&"Minutes"

werewolf
Your formula type should be Text if you're using that formula.  Is it?
werewolf
And you can't sum a text field.  If you want it to display in hours, you'll have to divide it by 60, but that will show you hours with a decimal percentage, like 3.54 hours.  Salesforce.com doesn't sum non-numbers like 4:35.
KimberlyJ
The field is a number field, which I can sum on my report.  I tried to add a formula into the report but I get error messages.
werewolf
You can add a formula field to your report, but you can't _sum_ a formula field that is of type text.
werewolf
You could, however, add _2_ custom summary fields to your report, one for hours and one for minutes, each one with its own math.
KimberlyJ
I guess I don't understand what "text" you are talking about.  I just want to add up my minutes and convert into hours on my report.  Can you explain please?
werewolf

You cannot make a formula field that converts minutes to a human-readable hours and minutes (like 4:35) and sum that.  Once it becomes "4:35" it is text and cannot be summed.

As such, there's really no combination of formula fields you can add to the Activity object itself that would produce the desired effect.

The only real way to do what you want to do is create 2 custom summary fields on the report.  The hours formula would be like:

FLOOR(DURATION:SUM/60)

The minutes formula would be:

MOD(DURATION:SUM,60)

These would be custom summary formulas, so you'd actually add them in step 2 of the report wizard to a Summary Report, not to the Activity object.

KimberlyJ

ok, but I just want the readable #hours #minutes format on the report, not in the activity.  I'm happy with 75minutes in an activity.  When I run the report on all the activities of all the minutes, no decimals, I want the bottom row to say #hours, #minutes. is that possible?

KimberlyJ
I GOT IT!!! I read it over and over and it finally clicked!  Thank  you so much for your time!  You rock!