You need to sign in to do that
Don't have an account?
Date formula help
Hi,
I have the following formula to automatically calculate the end date (start_date__c + 3 month) for all products other than "standard".
However I would like to replace the false IF statement right at the end (null) by [ Month(start_date__c) +12 ] but I get an error message: Error: Incorrect parameter for function 'if()'. Expected Date, received Number
Do you know how to stop getting this error?
Thank you,
E
if( PricebookEntry.Product2.Name <> "Standard", DATE(YEAR(Start_Date__c),
MONTH(Start_Date__c)+3,
CASE( MONTH(Start_Date__c)+3,
1, 31,
2, IF( MOD( YEAR(Start_Date__c), 4) = 0, 29, 28),
3, 31,
4, 30,
5, 31,
6, 30,
7, 31,
8, 31,
9, 30,
10, 31,
11, 30,
12, 31,
0 )
), null)
You're missing the DATE function and the YEAR and DAY portions of the DATE(YYYY, MONTH(start_date__c)+12, DD) so the Else result in your formula is basically just shoving a number into the Formula(Date) field.
All Answers
Can you post the Formula that is giving you the error? Also, could you post a screenshot of the error message? (the location of the error is usually highlighted)
Hi SteveMo,
Here is the formula:
if( PricebookEntry.Product2.Name <> "Standard", DATE(YEAR(Start_Date__c),
MONTH(Start_Date__c)+3,
CASE( MONTH(Start_Date__c)+3,
1, 31,
2, IF( MOD( YEAR(Start_Date__c), 4) = 0, 29, 28),
3, 31,
4, 30,
5, 31,
6, 30,
7, 31,
8, 31,
9, 30,
10, 31,
11, 30,
12, 31,
0 )
), MONTH(start_date__c)+12) << This statement is giving me the error.
Error: Incorrect parameter for function 'if()'. Expected Date, received Number
Thanks
E
By the way, the error location is not highlighted, I'm going to try in another browser and post.
You're missing the DATE function and the YEAR and DAY portions of the DATE(YYYY, MONTH(start_date__c)+12, DD) so the Else result in your formula is basically just shoving a number into the Formula(Date) field.
Thanks SteveMo, I will try and sort this out with your info.
E
http://boards.developerforce.com/t5/user/viewprofilepage/user-id/6057
Do you still need help with this or are you all set?
Hi SteveMo,
It's all good thanks! I'll close this.
Edith