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
hudinihudini 

calculating cost per hours - one little bug!

Hi there,
I have this formula
(Rate__c *  Number_of_Hours__c) + (Rate__c /(60/ Number_of_Minutes__c ))
to calculate total sum to be paid based on hours and minutes worked.
The problem is, the if the minute field is left blank, I receive an #Error#. If I leave the hour field blank - it's fine, so I've been compensating by making 1 hour into 60 minutes, and it's doing nicely, but it's not ideal!
anyone have any suggestions?
thanks!
Hudi
CurtAllen.ax323CurtAllen.ax323
It sounds like what is happening is you have the hour field using a default value of 0 and the minute field with a default of blank (NULL.)  When you divide, or multiply, by zero your equation will still validate.  However when you try to use any math function with NULL it will not validate and return an error.
hudini007hudini007
so how do i do that?
CurtAllen.ax323CurtAllen.ax323
Change the default value of the field from blank to 0
hudini007hudini007
Thank you Curt, for responding and your help. It is still not working. I think there is a issue with my fromula that is not letting it have a number value greater than 1 in the minute field. can you look at it and tell me what you think?
thanks so much!
Hudi
hudini007hudini007
i got it . . .
(Rate__c * Number_of_Hours__c) + (Rate__c *(Number_of_Minutes__c /60))
it was your theory though :) can't divide by 0 but can do it the other way around! thanks alot!
Hudi