+ Start a Discussion
Danny@ReachLocalDanny@ReachLocal 

Syntax error on decimal in formula

good morning,

 

I'm trying to create a number formula field where we rank cases based on 2 fields:

Budget__c and Queue_sort_order__c (which is another formula field)

 

if a budget is over 20000, then we want to calculate the number given by Queue_sort_order__c by 10% (and add it to the current value in that field), if it's between 10001 and 20000, then calculate the queue_sort_order__c by 7.5% and add to the current value in queue_sort_order_c field, etc.

 

if(Budget__c > 20000, (.10  *  queue_sort_order__c) + queue_sort_order__c,
if(and(Budget__c > 10000, Budget__c<20001),  (.075  *  queue_sort_order__c) + queue_sort_order__c,
if(and(Budget__c > 5000, Budget__c<10001), (.05  *  queue_sort_order__c) + queue_sort_order__c,
if(Budget__c < 5001, (.025  *  queue_sort_order__c) + queue_sort_order__c
))))

 

but the formula is giving a syntax error on the decimal places in the formula ("." on .10, "." on .075, etc)....is there another way to express percentage in the arithmetic formula

(formula field output will have no decimal places)

 

thanks

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
Steve :-/Steve :-/

put a 0 in front of the decimal:  75% = 0.75  

 

Also, you could probably clean up your Formula a little, once you evaluate a MAX value, you do not have to re-valuate it again.  

 

for example:

 

IF(Score > 90, "A",
IF(Score > 80, "B",
IF(Score > 70, "C",
IF(Score > 60, "D",
"FAIL"))))

 

 

 

All Answers

Steve :-/Steve :-/

put a 0 in front of the decimal:  75% = 0.75  

 

Also, you could probably clean up your Formula a little, once you evaluate a MAX value, you do not have to re-valuate it again.  

 

for example:

 

IF(Score > 90, "A",
IF(Score > 80, "B",
IF(Score > 70, "C",
IF(Score > 60, "D",
"FAIL"))))

 

 

 

This was selected as the best answer
Danny@ReachLocalDanny@ReachLocal

Thanks Stevemo,

 

cleaned up my formula per suggestion as well.

ErikNelke1ErikNelke1
Can't imagine for fun it is to find an answer from 6 years ago helping me today. That leading zero had me stumped. Lesson learned.
Ryan Berens 9Ryan Berens 9
Just to echo Erik here - but adding - how about 10 years?

Thanks!