Rounding values to nearest 500
I have a series of numbers that run from in the tens to the ten thousands. I want to set the following rounding rules:
Above 10,000, round to nearest 1,000
Below 10,000 but above 1,000, round to nearest 500
Below 1,000, round to nearest 100
// Work out some custom rounding for specific values
if ( varRec.annual_kWh_saving <= 1000 )
{
varKwh = varRec.annual_kWh_saving.toDecimal().round(-2);
}
else
{
varKwh = varRec.annual_kWh_saving.toDecimal().round(-3);
}
How would I apply rounding to nearest 500?
Access your files securely from anywhere
Zoho Developer Community
Deliver unforgettable customer experiences
Deliver unforgettable customer experiences
New to Zoho Marketing Plus?
Everything you need to run your marketing
New to Zoho Marketing Plus?
Everything you need to run your marketing
Zoho Desk Resources
-
Desk Community Learning Series
-
-
-
-
-
-
-
-
-
Zoho TeamInbox Resources
Zoho DataPrep Resources
Zoho CRM Plus Resources
Zoho Books Resources
Zoho Subscriptions Resources
Zoho Projects Resources
Zoho Sprints Resources
Qntrl Resources
Zoho Creator Resources
Zoho Campaigns Resources
Zoho CRM Resources
Zoho Show Resources
Writer Get Started. Write Away!
Writer is a powerful online word processor, designed for collaborative work.