User Story
Calculate the Account Score
0 points when the following (each) fields are null or empty, 10 points when they have values.
AnnualRevenue
Rating
Active
Phone
Expectation
An Account will have 40 points if none of the foll0woing fields are null or empty
AnnualRevenue
Rating
Active
Phone
Code
(IF( AnnualRevenue = 0, 0, 10)) +
(IF(ISPICKVAL(Rating, "") , 0, 10)) +
(IF(ISPICKVAL(Active, "No") , 0, 10))+
(IF(Phone="" , 0, 10))
Explanation
This formula uses a combination of IF and ISPICKVAL functions to calculate a "Contact Score" based on certain criteria.
The IF function checks if a certain condition is true or false, and returns one value if the condition is true, and another value if the condition is false.
The ISPICKVAL function checks if a picklist field has a certain value.
The first IF function checks whether the AnnualRevenue field is equal to 0, if yes it returns 0, otherwise it returns 10.
The second IF function checks whether the Rating field is blank (using ISPICKVAL function) if yes it returns 0, otherwise it returns 10.
The third IF function checks whether the Active field is equal to "No" (using ISPICKVAL function) if yes it returns 0, otherwise it returns 10.
The fourth IF function checks whether the Phone field is blank, if yes it returns 0, otherwise it returns 10.
All these values are summed up in the end to get the Account Score.
So, this formula can be used to calculate a score based on certain criteria related to a Account object in Salesforce, and it returns a final score by summing up all of the individual scores.