Forum Discussion

Aqua-holic's avatar
Aqua-holic
Copper Contributor
Aug 25, 2022

Add to an existing formula, how to return "0" in Calculated Column when column is empty

I have this formula that returns positive and negative values correctly (returns a positive or negative number of days between 2 (estimated) dates). I wish to add a caveat that if a date column is e...
  • kalpeshvaghela's avatar
    Aug 26, 2022

    Aqua-holic 

     

    You should first check whether any one of the column is empty and if it's empty then show 0, then you should check which date is bigger and based on date you should find out difference. In below formula I have considered ColumnB as latest date that means if ColumnA date will be greated than ColumnB then it will so day different in negative.

     

     

     

    =IF(OR(ISBLANK([ColumnA]),ISBLANK([ColumnB])),"0",IF([ColumnA] > [ColumnB],-DATEDIF([ColumnB],[ColumnA],"d"),DATEDIF([ColumnA],[ColumnB],"d")))

     

     

     

    Below is the output of above formula:

     

    Official Documentation: Calculated Field Formulas

     


    Hope it will helpful to you and if so then Please mark my response as Best Response & Like to help others in this community

Resources