# Percentage Formula Field based on Picklist values

I have a picklist called state and each state has its own percentage rate. I created a percentage formula field where if the user select the State X, this percentage field should display the rate for that state. I wrote the following formula:

``````IF(ISPICKVAL(Estado__c , "São Paulo"), "4",
``````

Error: Formula result is data type (Text), incompatible with expected data type (Percent).

What's wrong? Can you help me with the eight formula for it?

• First thing to try is to drop the quotes around the numbers i.e. use `4` instead of `"4"` etc and change `"Others"` to `0`. Using CASE would be a bit clearer too. Nov 9, 2015 at 14:46
• Hi Keith! Thanks for your answer. I changed the "4" to 0.04 and "others" to 0.00 , and the formula worked. So, the formula is, just a small sample: IF(ISPICKVAL(Estado__c , "São Paulo"), 0.04, IF(ISPICKVAL(Estado__c , "Rio de Janeiro"), 0.04, IF(ISPICKVAL(Estado__c , "Minas Gerais"), 0.04, IF(ISPICKVAL(Estado__c , "Rio Grande do Sul"), 0.03, IF(ISPICKVAL(Estado__c , "Amazonas"), 0.03, IF(ISPICKVAL(Estado__c , "Goiás"), 0.00, 0.00)))))))))))))))))))))))))) Nov 9, 2015 at 15:29
• Good. Still think you should be using CASE though! Nov 9, 2015 at 15:31
• Case instaed of spickval? Nov 9, 2015 at 17:01

You could do something similar to:

``````Case(TEXT(Estado__c),
"São Paulo", 4,
"Rio de Janeiro", 4,
"Minas Gerais, 4
"Goiás", 0,
0
)
``````

In my opinion this becomes more readable than multiple IF statements. You can then imbed this into the current formula you are using.

Here is the link to documentation on the case field: Salesforce Help: Formula - Case