Skip to main content
I am trying to create a formula field (number) that assignes a value (-1,1 or 0) based on the value of a number field on the same record.

 

The field I am basing the calculation on is a number field called Customer NPS. It is populsated automatically via a survey. Values that could be populated here are the numbers zero through ten.

 

As mentioned above, I am creating a new formula field called NPS Calc which will assign the -1, 1 or 0 value based on the score provided in Customer NPS. as follows:

 

Customer NPS of 0-6 should be assigned a "-1"

 

Customer NPS of 7-8 should be assigned a "0"

 

Customer NPS of 9-10 should be assigned a "1"

 

Here is the first formula I tried:

 

IF(Customer_NPS_Score__c > 7, "-1",

 

IF(Customer_NPS_Score__c < 8, "1",

 

"0"))

 

Error: Formula result is data type (text), incompatable with expected data type (number)

 

I also tried this formula and received the exact same error:

 

CASE(Customer_NPS_Score__c,

 

0, "-1",

 

1, "-1",

 

2, "-1",

 

3, "-1",

 

4, "-1",

 

5, "-1",

 

6, "-1",

 

7, "0",

 

8, "0",

 

9, "1",

 

10, "1",

 

"0")

 

Not sure where I am going wrong here. The Customer_NPS_Score__c is a number field, and the formula field I am trying to build has an output of a number with zero decimals (exact same format as the Customer NPS Score field).

 

Any insights would be appreciated.
8 respostas
  1. 1 de ago. de 2014, 15:45
    On your first attempt, remove the quotes around the values so they are not treated as strings and you'll be all set.
0/9000