+ Start a Discussion
Subs KSubs K 

cant use multiple If statements in formulas

Hi Everyone,

I am using the developer edition and my question is regarding adding multiple If statements to formulas within an object. 

I am trying to write a formula to assign a value to certain feilds so I can create a score for each account and rate them base on the score.
For example, one of the creiteria for the score is a feild name, "Number of properties" which happens to be 30 I want to assign a score of 25.
using if :  IF(logical_test, value_if_true, value_if_false) 
Heres what i got so far: 
IF((number_of_property__c <= 5), 5, 0)
IF((5 < number_of_property__c) <= 10), 10, 0)
IF((10 < number_of_property__c) <= 20),15, 0)
IF((20 < number_of_property__c) <= 30),20, 0)
IF((30 < number_of_property__c)),25, 0)

i keep getting a "Error: Syntax error. Extra IF" on the second IF on line 2

if there is a better way to do this or if you know why im getting this error please let me know anything helps

Edwin VijayEdwin Vijay
You should nest your IF's to be able to use multiple, a better approach would be to use the CASE function

Ex:
IF(logical_test, value_if_true, IF(logical_test, value_if_true, IF(logical_test, value_if_true, value_if_false) ) ) 
Manmohan SinghManmohan Singh
Make is simple and use case :)

CASE(Picklist_Field__c,
‘One’, 4,
‘Two’, 8,
‘Three’, 20,
‘Four’, 100,
0)
Wendy YenWendy Yen
Hi - i am new to using formulas. please bear with me.
I have a field name "forecast stage", say it has a few fixed values like Booked, Commit, Upside, Lost.

I want to create each formula that says 
1) if forecast stage = Booked, sum oppty amount
2) if forecast stage = Commit, sum oppty amount 

But when i go into Formulas, the "Summary Fields" section do no show "forecast stage". Does this means that i cannot create formula because the field is not showing there?

thanks