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
Wayne GladmanWayne Gladman 

Creating a Lead Scoring formula field based on age

Hello, I'm trying to build a lead scoring formula based on age of a lead

I've created the below formula but am getting the error:  Incorrect parameter type for function 'IF()'. Expected Text, received Number. (I've tried this as a CASE formula and got a syntax error highlighting <=)

IF(Lead_Age__c,<=5 and >=0,"10",
IF(Lead_Age__c,<=10 and >=6,"6",
IF(Lead_Age__c,<=35 and >=11,"9",
IF(Lead_Age__c,<=60 and >=36,"4",
IF(Lead_Age__c,<=90 and >=61,"2",
IF(Lead_Age__c,>=91,"8",
null))))))

Basically the formula is meant to say for the first line for instance if the lead age is between (or equal) 0-5 then the score will be 10.

Not sure why an IF formula can't produce a number so any help would be appreciated.

Thanks,
Best Answer chosen by Wayne Gladman
Jayeshkumar ParmarJayeshkumar Parmar

Hi  Wayne Gladman,

Try this formula,

IF((Lead_Age__c <= 5 && Lead_Age__c>=0), 10,  IF( (Lead_Age__c <= 10  && Lead_Age__c >=6) , 6,  IF((Lead_Age__c <= 35 && Lead_Age__c>= 11), 9,  IF((Lead_Age__c <=60 && Lead_Age__c >= 36), 4,  IF((Lead_Age__c <= 90 && Lead_Age__c >= 61), 2,  IF(Lead_Age__c >=91, 8, null) ) ) ) ) )

If this helps,please mark it as best answer
 
Thanks.

All Answers

Jayeshkumar ParmarJayeshkumar Parmar

Hi  Wayne Gladman,

Try this formula,

IF((Lead_Age__c <= 5 && Lead_Age__c>=0), 10,  IF( (Lead_Age__c <= 10  && Lead_Age__c >=6) , 6,  IF((Lead_Age__c <= 35 && Lead_Age__c>= 11), 9,  IF((Lead_Age__c <=60 && Lead_Age__c >= 36), 4,  IF((Lead_Age__c <= 90 && Lead_Age__c >= 61), 2,  IF(Lead_Age__c >=91, 8, null) ) ) ) ) )

If this helps,please mark it as best answer
 
Thanks.
This was selected as the best answer
AnkaiahAnkaiah (Salesforce Developers) 
Hi Wayne,

Can you please check your formula return type,Instead of number you have taken text.  Use the below formula
 
IF((Lead_Age__c <= 5 && Lead_Age__c  >=0),10,
IF((Lead_Age__c <=10 && Lead_Age__c>=6),6,
IF((Lead_Age__c <=35 && Lead_Age__c>=11),9,
IF((Lead_Age__c <=60 && Lead_Age__c >=36),4,
IF((Lead_Age__c <=90 && Lead_Age__c  >=61),2,
IF(Lead_Age__c>=91,8,
null))))))