[SalesForce] 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",
IF(ISPICKVAL(Estado__c , "Rio de Janeiro"),"4",
IF(ISPICKVAL(Estado__c , "Minas Gerais"), "4",
IF(ISPICKVAL(Estado__c , "Goiás"), "0", "Others"))))

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?

Best Answer

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