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?
Zoho Desk Resources
-
Desk Community Learning Series
-
-
-
-
-
-
-
-
-
Zoho CRM Plus Resources
Zoho Books Resources
Zoho Subscriptions Resources
Zoho Projects Resources
Zoho Sprints Resources
Zoho Orchestly Resources
Zoho Creator Resources
Zoho WorkDrive Resources
Zoho Campaigns Resources
Zoho CRM Resources
Writer Get Started. Write Away!
Writer is a powerful online word processor, designed for collaborative work.