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
Chetan Nawale 15Chetan Nawale 15 

salesforce formula field #error

Hi All,
I am getting Error as #error in few records in formula field .
below is formula field. please sugget me.
IF(ISPICKVAL(Status__c,'Active'), 
(IF((TODAY()>=DATE(YEAR(Renewal_Date__c)- (IB_Products_Country_Attributes__r.Phase_1_End_Date_Months__c/12) ,MONTH(Renewal_Date__c),DAY(Renewal_Date__c)) && (TODAY()<=Renewal_Date__c)),'Renewal', 
IF(TODAY()<=DATE(YEAR(Install_Date__c) + (IB_Products_Country_Attributes__r.Phase_3_Start_Date_Months__c/12),MONTH(Install_Date__c),DAY(Install_Date__c)),'Initial',
IF((Today()> Renewal_Date__c) || (ISBLANK(Renewal_Date__c)),'Renewal Overdue',
'Operational')))),'')


Thanks,
Chetan
SalesFORCE_enFORCErSalesFORCE_enFORCEr
It is showing error because the field values dont satisfy any of the if else criteria hence it is goign to the final else which is not defined.
Irvin Gustavo  Madrid GranadosIrvin Gustavo Madrid Granados
Try this..
IF(
   ISPICKVAL(Status__c,'Active'),
   IF(
      AND(
         TODAY()>=DATE(YEAR(Renewal_Date__c)-(IB_Products_Country_Attributes__r.Phase_1_End_Date_Months__c/12),MONTH(Renewal_Date__c),DAY(Renewal_Date__c)),
         TODAY()<=Renewal_Date__c
      ),
      'Renewal', 
      IF(
         TODAY()<=DATE(YEAR(Install_Date__c)+(IB_Products_Country_Attributes__r.Phase_3_Start_Date_Months__c/12),MONTH(Install_Date__c),DAY(Install_Date__c)),
         'Initial',
         IF(
            OR(
               Today()> Renewal_Date__c, 
               ISBLANK(Renewal_Date__c)
            ),
            'Renewal Overdue',
            'Operational'
         )
      )
   ),
   ''
)
Chetan Nawale 15Chetan Nawale 15

Hi Irvin Gustavo Madrid Granados

Thank you the code,

but I got again the same #Error on formalula field. 

I observed something, this Error is happening because of Renewal_Date__c is 29 Feb , which is leap year. 

If I am changing the Renewal_Date__c to 28 Feb then formula is working.

Thanks,
Chetan