1

Hello if anyone can help me solve this.

I am trying to create a process builder that rounds off decimals to the nearest .25 , .50, .70 and 1 hour. For instance a user would log time at .23 then it should round off to .25 and same goes when user logs 2.27 hours then this should round to 2.50?

Any kind of suggestions would be great.

Thank you

1
  • you can write your custom round logic based on the upper and lower limit Feb 12, 2018 at 6:00

2 Answers 2

1

Doing it in Apex trigger might be simpler.. but if you want to do it workflow / process, try this approach..

Round down the actual value and take the difference between the actual value & round down value and run a comparison & add the closest value you want..

Floor(Field__c) + 
IF( Field__c - Floor(Field__c) < 0.25, 0.25,
IF( Field__c - Floor(Field__c) < 0.5, 0.5,
IF( Field__c - Floor(Field__c) < 0.75, 0.75, 1)))
0

I know this is old, but the above solution is ALMOST correct :) Needs to handle zeros as well, and must also have <= (otherwise 0.25 is rounded to 0.5). So it should look like:

Floor(Field__c) + 
IF( Field__c - Floor(Field__c) = 0, 0,
IF( Field__c - Floor(Field__c) <= 0.25, 0.25,
IF( Field__c - Floor(Field__c) <= 0.5, 0.5,
IF( Field__c - Floor(Field__c) <= 0.75, 0.75, 1))))

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .