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
Elizabeth Bouma 5Elizabeth Bouma 5 

Help with nested/multiple IF statements

I am trying to create a dynamic date formula field. We want to use it to sort our different kinds of projects in list views on the account.

Below are the three IF statements that I have developed. All entries are a record type of Assessment, Prospect, or Application and based on the record type, I want to select a date that is not NULL (which will always be one of the two).

IF(AND(RecordType.Name = "Assessment", Assessment_Completed_Date__c = NULL), DATEVALUE(CreatedDate),Assessment_Completed_Date__c),

IF(AND(RecordType.Name = "Application", eo3__Payment_Date__c = NULL), Date_Pre_Application_Received__c,eo3__Payment_Date__c),

IF(RecordType.Name = "Prospect",  eo3__Estimated_Completion_Date__c )
Peter IkladiousPeter Ikladious
Were you looking for something like this:
 
IF(AND(RecordType.Name = "Assessment", Assessment_Completed_Date__c != NULL), Assessment_Completed_Date__c),
        IF(AND(RecordType.Name = "Application", eo3__Payment_Date__c != NULL), eo3__Payment_Date__c, 
                IF(RecordType.Name = "Prospect",  eo3__Estimated_Completion_Date__c, Date_Pre_Application_Received__c)
        )
)

You should probably create a truth table which maps all the possible outcomes.  Then you embed each subsequent "IF" statement in the ELSE position of the prior IF statement.