function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Heena ChauhanHeena Chauhan 

Urgent - Formula Query.

Hello All,
I wanted to convert Days,Hours into Minutes and populate the value in minutes field as a SUM value of all i.e. (Days(should be converted into minutes)+Hours(should be converted into minutes) +Minutes = Minutes).

Example:
I have a field Days which is populated from below formula: 
Text( FLOOR( Date_Time_Gas_Off__c - Date_Time_Gas_Riser_Commissioned__c ) )

Now, I want to populate Minutes value which should be a SUM of Days(converted to mins)+Hours(converted to mins)+Minutes for which I have a formula as shown below:

Text(FLOOR((( Date_Time_Gas_Off__c - Date_Time_Gas_Riser_Commissioned__c) *1440)*24)   //Days//
+
Text(ROUND(((Date_Time_Gas_Off__c - Date_Time_Gas_Riser_Commissioned__c )*60),0))         //Hours//
+
Text(ROUND(((Date_Time_Gas_Off__c - Date_Time_Gas_Riser_Commissioned__c )))))                 //Minutes//

When I try to execute the formula, I get an error as :
Error: Incorrect parameter type for operator '+'. Expected Number, Date, DateTime, received Text

Please assist me with the correct formula to display the value in minutes. 

Thanks in advance!

 
Best Answer chosen by Heena Chauhan
Tavva Sai KrishnaTavva Sai Krishna
Hi Heena,

Try below formula .Error is with the return type of the field you selected. As you selected the formula field return type as number and using the TEXT function whose return type is TEXT leads the output as TEXT. So Either change the formula field return type to TEXT else try below code.
FLOOR((( Date_Time_Gas_Off__c - Date_Time_Gas_Riser_Commissioned__c) *1440))   //Days//
+
ROUND(((Date_Time_Gas_Off__c - Date_Time_Gas_Riser_Commissioned__c )*60),0)        //Hours//
+
ROUND(((Date_Time_Gas_Off__c - Date_Time_Gas_Riser_Commissioned__c )))              //Minutes//

Let me know if you face any issues,

Thanks and regards,
Sai Krishna Tavva

All Answers

Tavva Sai KrishnaTavva Sai Krishna
Hi Heena,

Try below formula .Error is with the return type of the field you selected. As you selected the formula field return type as number and using the TEXT function whose return type is TEXT leads the output as TEXT. So Either change the formula field return type to TEXT else try below code.
FLOOR((( Date_Time_Gas_Off__c - Date_Time_Gas_Riser_Commissioned__c) *1440))   //Days//
+
ROUND(((Date_Time_Gas_Off__c - Date_Time_Gas_Riser_Commissioned__c )*60),0)        //Hours//
+
ROUND(((Date_Time_Gas_Off__c - Date_Time_Gas_Riser_Commissioned__c )))              //Minutes//

Let me know if you face any issues,

Thanks and regards,
Sai Krishna Tavva
This was selected as the best answer
Heena ChauhanHeena Chauhan
Thank you for your quick Response Sai.

However, I am trying using the above formula but getting an error as below:

Error: Incorrect number of parameters for function 'ROUND()'. Expected 2, received 1.

Please assist.

Many Thanks!!
VineetKumarVineetKumar
One value was missing in the formulae, please find below the corrected formula
FLOOR((( Date_Time_Gas_Off__c - Date_Time_Gas_Riser_Commissioned__c) *1440))   
+
ROUND(((Date_Time_Gas_Off__c - Date_Time_Gas_Riser_Commissioned__c )*60),0)    
+
ROUND((Date_Time_Gas_Off__c - Date_Time_Gas_Riser_Commissioned__c ), 0)      

 
Heena ChauhanHeena Chauhan
Pefect!!
 It worked Sai ,Vineet.

Thank you Vineet and Sai for your quick response.

Cheers!!