1

I'm trying to segregate records by month name for the first three months of the year. Everything with a date range of 1/1/19 through 1/31/19, should return JAN, for example.

I'm getting syntax errors of a missing parenthesis. Here's what I wrote:

IF(AND(Application__c.CreatedDate>=(2019,1,19),Application__c.CreatedDate<=(2019,1,31)),"JAN",IF(AND(Application__c.CreatedDate<=(2019,2,1),Application__c.CreatedDate<=(2019,2,18)),"FEB",IF(AND(Application__c.CreatedDate>=(2019,3,1),Application__c.CreatedDate<=(2019,3,31)),"MAR","")))
3

Use a CASE function. Its much easier to write. Also, it will avoid issue in leap year.

CASE(MONTH(PO_Received_Date__c),
1, "January",
2, "February",
3, "March", 
4, "April", 
5, "May", 
6, "June",
7, "July",
8, "August",
9, "September",
10, "October",
11, "November",
12, "December",
"None")
  • Thank you. These are helpful comments. Now I receive an incorrect parameter message: Warning Incorrect parameter type for function 'MONTH()'. Expected Date, received Object – user65727 Mar 15 at 14:54
  • 1
    the variable that you are using in Month Function is not a date – m Peixoto Mar 15 at 15:23
1

Application__c.CreatedDate>=(2019,3,1)

(2019,3,1) isn't a valid date format. In formulas, to create dates, you need to use the DATE(year,month,day). You can fix your code by adding DATE to your date values.

Application__c.CreatedDate >= DATE(2019, 3 ,1)

Issues with your code aside, it makes much more sense to use CASE on the MONTH of the date field instead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.