+ Start a Discussion
murdocmurdoc 

What is this formula supposed to be doing?

Hey all!
I have an old formula in our org and I'm trying to make sure it's doing what I think it's doing? If not we got some 'splaining to do. :) Anyway here's the code:
IF(AND(NOT(ISPICKVAL(Type , "General, Corporate Event, Exposition, Non-Revenue, Sub-Contract, Maritz" )),(RecordTypeId = "0123000000092IT")

&&
TODAY() >= DATE( IF(MONTH(Pipeline_Date__c)=12, YEAR(Pipeline_Date__c )+1, YEAR(Pipeline_Date__c )), IF(MONTH(Pipeline_Date__c)=12,1,MONTH(Pipeline_Date__c)+1), 15)),
Total_Revenue_Actual__c ,
Amount )

Okay, what do you think it's doing? I will speak about you very fondly if you can figure it out. Thanks!
Wilfredo Morillo 20Wilfredo Morillo 20
This formula is checking the following condition:
If{
    Type contains (General, Corporate Event, Exposition, Non-Revenue, Sub-Contract, Maritz)
and the record type ID = 0123000000092IT
and Today is greater or equal to the 15th of the month after Pipeline_Date__c,
if all conditions are met returns the value of Total_Revenue_Actual__c,
if not it returns the value of Amount 
}

Let me know if you get it. 
 
Nayana KNayana K
I have formatted the formula below for better understanding:

IF    
(
    AND(
        NOT(
            ISPICKVAL(Type , "General, Corporate Event, Exposition, Non-Revenue, Sub-Contract, Maritz" )
            ),
        (RecordTypeId = "0123000000092IT")
        &&
        TODAY() >= DATE( 
                        IF(
                            MONTH(Pipeline_Date__c)=12, 
                            YEAR(Pipeline_Date__c )+1, 
                            YEAR(Pipeline_Date__c )
                        ), 
                        IF(
                            MONTH(Pipeline_Date__c)=12,
                            1,
                            MONTH(Pipeline_Date__c)+1
                        )
                        , 
                        15)
        ),

    Total_Revenue_Actual__c ,
    Amount 
)
    
OUTCOME:    
1. Type != "General, Corporate Event, Exposition, Non-Revenue, Sub-Contract, Maritz" 
2. RecordTypeId = "0123000000092IT"
3. Assume calculation of some date say, "CalculatedDate".
    If Pipeline_Date__c (Eg, 01-12-2015) lies in Decemeber, then CalculatedDate = 15-01-2016 => 15th of next year Jan
    If Pipeline_Date__c (Eg, 01-08-2015) doesn't lies in Decemeber(In this case Aug), then CalculatedDate = 15-09-2016 => 15th of next month.
    Indirectly this is calculating 15th of next month. below line is simplified one:
    TODAY() >= 15th of next month (i.e, TODAY() >= CalculatedDate)

If all above 3 #s met, then formula will hold "Total_Revenue_Actual__c". Otherwise, holds "Amount".


NOTE: #1 is not comparing Type with General, Corporate Event, etc seperately(Means it doesn't work like CONTAINS). "General, Corporate Event, Exposition, Non-Revenue, Sub-Contract, Maritz" is single word here.
Wilfredo Morillo 20Wilfredo Morillo 20
you are right there: 
*If type is not (General, Corporate Event, Exposition, Non-Revenue, Sub-Contract, Maritz)
murdocmurdoc
Thanks to you both! This is what I suspected.