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
SeanOSeanO 

Creating Formual Field with AND statements inside an IF Statement

I am trying write a formual that uses if and AND statments.  the logic I am trying to write is

IF(RFP_Flight_Date__c > today (), ( Days_Remaining_in_RFP_Flight_This_Month__c * Estimated_Daily_Revenue__c ),IF(RFP_Flight_Date__c <= Today AND (Days_Remaining_in_the_Month__c  >  Days_Remaining_in_RFP_Flight__c),THEN (Estimated_Daily_Revenue__c * Days_Remaining_in_RFP_Flight__c),IF(RFP_Flight_Date__c <= Today AND (Days_Remaining_in_the_Month__c  < Days_Remaining_in_RFP_Flight__c),THEN(Estimated_Daily_Revenue__c * Days_Remaining_in_the_Month__c ),Otherwise 0

That is the logic I am trying to solve.  I just dont know how to write it so the AND statment is inside the IF statement.

Let me know if you have any questions

Thanks in advance

Sean

 
Best Answer chosen by SeanO
Romeo Ngo 1Romeo Ngo 1
try this 
IF(RFP_Flight_Date__c > today (), Days_Remaining_in_RFP_Flight_This_Month__c * Estimated_Daily_Revenue__c,
	IF(AND (RFP_Flight_Date__c <= Today, Days_Remaining_in_the_Month__c  >  Days_Remaining_in_RFP_Flight__c),
		Estimated_Daily_Revenue__c * Days_Remaining_in_RFP_Flight__c,
		IF(AND (RFP_Flight_Date__c <= Today, Days_Remaining_in_the_Month__c  < Days_Remaining_in_RFP_Flight__c),
			Estimated_Daily_Revenue__c * Days_Remaining_in_the_Month__c ,
			0
		)
	)
)

 

All Answers

Romeo Ngo 1Romeo Ngo 1
try this 
IF(RFP_Flight_Date__c > today (), Days_Remaining_in_RFP_Flight_This_Month__c * Estimated_Daily_Revenue__c,
	IF(AND (RFP_Flight_Date__c <= Today, Days_Remaining_in_the_Month__c  >  Days_Remaining_in_RFP_Flight__c),
		Estimated_Daily_Revenue__c * Days_Remaining_in_RFP_Flight__c,
		IF(AND (RFP_Flight_Date__c <= Today, Days_Remaining_in_the_Month__c  < Days_Remaining_in_RFP_Flight__c),
			Estimated_Daily_Revenue__c * Days_Remaining_in_the_Month__c ,
			0
		)
	)
)

 
This was selected as the best answer
SeanOSeanO
This worked perfectly I really apprecitate it.