+ Start a Discussion

What is the formula to automatically calculate the duration of a task?

I have created 2 fields, end date/time and the start date/time and would like the system to automatically calculate the duration in min so the user doesn't have to enter it themselves.

This solution applies whenever you want to express a duration or age, for instance if you want to compare when a record was modified to when it was created, you would compare the "LastModifiedDate" field with the "CreatedDate" field. To do that, you can create a formula field type of "number", called for instance "D2subD1" that contains this : {!LastModifiedDate} - {!CreatedDate} However, the result of this formula is a number whose integer part is the number of days, and whose decimals are hours and minutes expressed as a fraction of 1 day. For instance, it would return "13.5" for 13 days and 12 hours. To express this number in the format "13 days 12 hours 0 mn", you need to create another formula field of the type text that contains: IF ( {!D2subD1__c} > 0, TEXT(FLOOR( {!D2subD1__c})) & " days " & TEXT( FLOOR( 24 * ( {!D2subD1__c} - FLOOR({!D2subD1__c}) ))) & " hours" & TEXT( ROUND(60 * (ROUND( 24 * ( {!D2subD1__c} - FLOOR({!D2subD1__c}) ),8) - FLOOR( ROUND( 24 * ( {!D2subD1__c} - FLOOR({!D2subD1__c}) ),8)) ),0)) & " mn " , "") This can be applied for any subtraction of 2 date/time fields.




that's great way to calculate duration between two date&time fields!


What I am looking for right now is possibility (formula field) to define the end time. I have field 'Starting time' which is date and time field type. 

Then I have lessons with duration of 25 minutes, and a picklist which tells how many lessons there will be.

So if the picklist has value 2 (lessons)

I want to know when lessons are ending up:

Starting time (date/time) + 25minutes*2


I'm trying to solve this by displaying the starting time in minutes instead of days, and then be able to carry on with calculations. But. I seem not to be able to write a formula with right syntax.


Can you help me out with this one?

Best Regards,