Ask Search:
Laura HackettLaura Hackett 

Error with formula 'Error: Incorrect parameter type for function 'MONTH()'. Expected Date, received Text'

Hi all,

I am tryint to use a formula that checks if the start date and end date fall within the same month. If True it should use a different formula to populate the field than if false. In which case it populates the field with another field that was created by a formula

My formula so far is below and i am getting the above error message even when i change the output. I require a number in this field. New to admin so any help appreciated

IF (MONTH( "StartDate__c") = MONTH("EndDate__c"),if_true (" Days_in_invoiced_period__c "), if_false ("Dec__c"))
 
Best Answer chosen by Laura Hackett
Steve MolisSteve Molis
Remove the "quotes" around the API Field Names 
IF(
AND(
MONTH( StartDate__c) = MONTH(EndDate__c),
YEAR( StartDate__c) = YEAR(EndDate__c)
),
Days_in_invoiced_period__c, 
Dec__c)

 

All Answers

Steve MolisSteve Molis
Remove the "quotes" around the API Field Names 
IF(
AND(
MONTH( StartDate__c) = MONTH(EndDate__c),
YEAR( StartDate__c) = YEAR(EndDate__c)
),
Days_in_invoiced_period__c, 
Dec__c)

 
This was selected as the best answer
Laura HackettLaura Hackett
Thanks so much! Worked perfect
Steve MolisSteve Molis
No problem Laura, you owe me a beer ;-D