function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Chris McKaughanChris McKaughan 

Help with ISPICKVAL IF AND FORMULA

Hello,

I'm an noob and I'm trying to write a formula that compares a picklist value and a formula result and will enter a number (I need to do math in future formulas so can't use text). This is what I have:

IF(AND(ISPICKVAL( Size__c , "S"), Tier__c= "Tier 1"), 675,
IF(AND(ISPICKVAL( Size__c , "S"), Tier__c= "Tier 2"), 695,
IF(AND(ISPICKVAL( Size__c , "S"), Tier__c= "Tier 3"), 725,
Tier__c)))

Getting the following error:

Incorrect parameter type for function 'IF()'. Expected Number, received Text (Related field: Formula)

If I change the field type to Text and add quotes around the numbers it works but I really need it to be a number.

Any help would be greatly appreciated!!!!



Any help would be appreciated.
 
Best Answer chosen by Chris McKaughan
Pankaj_GanwaniPankaj_Ganwani
If you really need it to be number then you can use either 0 or -1 instead of using Tier__c in else part.

All Answers

Pankaj_GanwaniPankaj_Ganwani
IF(AND(ISPICKVAL( Size__c , "S"), Tier__c= "Tier 1"), 675,
IF(AND(ISPICKVAL( Size__c , "S"), Tier__c= "Tier 2"), 695,
IF(AND(ISPICKVAL( Size__c , "S"), Tier__c= "Tier 3"), 725,
Tier__c)))

The bold one in the above formula should be of type Number since your formula return type is Number.
Chris McKaughanChris McKaughan
Thanks for the reply. What if I just want to populate this field I'm creating with the number value? 
Pankaj_GanwaniPankaj_Ganwani
If you really need it to be number then you can use either 0 or -1 instead of using Tier__c in else part.
This was selected as the best answer
Chris McKaughanChris McKaughan
Perfect. THANK YOU!!!