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
Sourav PSourav P 

Syntax error in Creating a formula

Hi , Cann anyone plz help me urgenntly,
My below formula is showing a syntax error, Can anyone plz suggest where its gone wrong in syntax. I am using it in process builder.
When i tried it in formula editor, it showed the below error , But i dont think anywhere its wrong or couldnt able to figure it out. Thanks
Error: Syntax error. Missing '='
 
IF(
CASE( [Lead].Renewal_Month__c,
"January",1,
"February",2,
"March",3,
"April",4,     
"May",5,
"June", 6,
"July", 7,
"August", 8,
"September",9,
"October", 10,
"November", 11,
"December", 12,NULL)< MONTH(TODAY()),
IF(TEXT([Lead].Renewal_Month__c)="January",DATE(YEAR(TODAY()),12,1), 
DATE(YEAR(TODAY())+1,CASE([Lead].Renewal_Month__c,
"January",1,
"February",2,
"March",3,
"April",4, 
"May",5,
"June", 6,
"July", 7,
"August", 8,
"September",9,
"October", 10,
"November", 11,
"December", 12,NULL)-1,1)),
DATE(YEAR(TODAY()), MONTH(TODAY())-1, 1)

 
Best Answer chosen by Sourav P
salesforceMannsalesforceMann
In the last line change:- MONTH(TODAY())-1 To:- CASE( [Lead].Renewal_Month__c, "January",1, "February",2, "March",3, "April",4, "May",5, "June", 6, "July", 7, "August", 8, "September",9, "October", 10, "November", 11, "December", 12,NULL)-1

All Answers

salesforceMannsalesforceMann
Hello Sourav P,

There are 2 errors:
  1. Add a right bracket i.e. ")" at the end on line 29
  2. Fields in the formula builder are not referenced using this notation "[Lead].Renewal_Month__c". If I replace this field with a string say abcd, the formula has no errors. (see screenshot below)
User-added image

Hope it helps.
Regards,
Mann.

Please mark as best answer if it solves your ques. :)
Sourav PSourav P
Hi Mann,
I put the " )", actually while copying here, it was missing .But its till showing the same syntax issue. I am using it in process builder.

User-added image
User-added image
Can you plz suggest , why its going wrongg here.
Sourav PSourav P
Btw, when i am putting the same " abcd" in formula editor, its till showing me syntax error, thats strange

User-added image
salesforceMannsalesforceMann
Can you paste an image of your browser page to show the error and see whr u r entering this formula.
Sourav PSourav P
Hi Mann
Sure, do you mean the below,

User-added image
 
salesforceMannsalesforceMann
Referring to your reply "Btw, when i am putting the same " abcd" in formula editor, its till showing me syntax error, thats strange"-

Even in the formula editor you are getting the error? Did you see my screenshot! I am not getting the error.!!
Sourav PSourav P
Hi Mann, Yup, its strange that why i am getting the error. Is it possible to try in the process builder, if its showing you the same syntax error ? Thanks
Sourav PSourav P
I am not able to figure out where exactly i am goe wrong, everything seems fine.
salesforceMannsalesforceMann
What is ur org realease version?
Sourav PSourav P
We are using the latest Winter-17 release ( Enterprise edition)
salesforceMannsalesforceMann
I am afraid I need access to the system to provide further assistance. Why dont you PM me, and we can discuss how to do that. Warm regards Harleen Singh Mann
Sourav PSourav P
Sure Harleen, Thank you so much. If i can know your skype ID plz ? mine is " sourav.patel"
salesforceMannsalesforceMann
Ive added you. Lets connect in about 45mins from now Warm regards Harleen Singh Mann
Sourav PSourav P
Sure, thanks. i am online. plz ping me once you free. thank for your help :)
Sourav PSourav P
sry, hope you added the correct name, as i cant see your invitation :)
salesforceMannsalesforceMann
Can you email me from your personal email at my temporary email ID - salesforcemann@mailinator.com
Sourav PSourav P
Dear Mann, i changed a bit teh formula and now it worked , But only issue is that, while i am choosing the " renewal mmonth " field as December, it should create aa task for 1/11/2016 But it is creating as 1/10/2016. Rest everything is OK. Can you plz help me out how to make it fixed ? thnx
IF(
CASE( [Lead].Renewal_Month__c,
"January",1,
"February",2,
"March",3,
"April",4,     
"May",5,
"June", 6,
"July", 7,
"August", 8,
"September",9,
"October", 10,
"November", 11,
"December", 12,NULL)< MONTH(TODAY()),
IF(TEXT([Lead].Renewal_Month__c)="January",DATE(YEAR(TODAY()),12,1), 
DATE(YEAR(TODAY())+1,CASE([Lead].Renewal_Month__c,
"January",1,
"February",2,
"March",3,
"April",4, 
"May",5,
"June", 6,
"July", 7,
"August", 8,
"September",9,
"October", 10,
"November", 11,
"December", 12,NULL)-1,1)),
DATE(YEAR(TODAY()), MONTH(TODAY())-1, 1))

 
salesforceMannsalesforceMann
There has to be an extra -1 somewhere.
Sourav PSourav P
No, i dont think so, because for other months its working fine, its only for December. May be the " December", 12, need to be get modified seems.
salesforceMannsalesforceMann
In the last line change:- MONTH(TODAY())-1 To:- CASE( [Lead].Renewal_Month__c, "January",1, "February",2, "March",3, "April",4, "May",5, "June", 6, "July", 7, "August", 8, "September",9, "October", 10, "November", 11, "December", 12,NULL)-1
This was selected as the best answer
Sourav PSourav P
Ya seems you right, may be that can work. because its taking current month November, rather than December. Let me try that. thanks a lot Harleen
salesforceMannsalesforceMann
If it works do mark as best answer: )
salesforceMannsalesforceMann
Hi Sourav, if it has worked,please mark as best answer!
 
Sourav PSourav P
Hi mann , thanks a lot, but seems there is an issue. Its showing the formula expression is not valid, when i replace the aboce. Can you suggest plz
Sourav PSourav P
Hi Harleen, Finally it worked. thanks a lot :)