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
Medhanie HabteMedhanie Habte 

Creating a formula to compare date values that don't match

Greetings, I am looking to create a formula field that compares data values. In the event that the dates don't match up. If they don't I want to create that refers the date in the account field if it is less than that in the contact field, and vice versa. 
 
IF(npo02__FirstCloseDate__c <> Account.npe01__FirstDonationDate__c,
IF(npo02__FirstCloseDate__c < Account.npe01__FirstDonationDate__c, npo02__FirstCloseDate__c,
IF(npo02__FirstCloseDate__c > Account.npe01__FirstDonationDate__c, Account.npe01__FirstDonationDate__c
,npo02__FirstCloseDate__c
)))
However, I get this error message reading Error: Incorrect number of parameters for function 'IF()'. Expected 3, received 2.

Any thing I'm missing. Hope it helps.
 
Best Answer chosen by Medhanie Habte
anto nirmalanto nirmal
Hi Medhanie,

As I understand your requirment is:
If both are dates are equal, then populate any date as they are same.
If they are different, use the earliest date.

The following formula should suffice the requirment and work without any issues.
Let me know in caser of any issue.
IF(npo02__FirstCloseDate__c <> Account.npe01__FirstDonationDate__c,
IF(npo02__FirstCloseDate__c < Account.npe01__FirstDonationDate__c, npo02__FirstCloseDate__c,
Account.npe01__FirstDonationDate__c),Account.npe01__FirstDonationDate__c)
As a common practice, if your question is answered, please choose 1 best answer.
Additionally you can give every answer a like if that answer is helpful to you.

Regards,
Anto Nirmal
 

All Answers

anto nirmalanto nirmal
Hi Medhanie,

As I understand your requirment is:
If both are dates are equal, then populate any date as they are same.
If they are different, use the earliest date.

The following formula should suffice the requirment and work without any issues.
Let me know in caser of any issue.
IF(npo02__FirstCloseDate__c <> Account.npe01__FirstDonationDate__c,
IF(npo02__FirstCloseDate__c < Account.npe01__FirstDonationDate__c, npo02__FirstCloseDate__c,
Account.npe01__FirstDonationDate__c),Account.npe01__FirstDonationDate__c)
As a common practice, if your question is answered, please choose 1 best answer.
Additionally you can give every answer a like if that answer is helpful to you.

Regards,
Anto Nirmal
 
This was selected as the best answer
Medhanie HabteMedhanie Habte
Thanks! Works Great