Forum Discussion
Add to an existing formula, how to return "0" in Calculated Column when column is empty
- Aug 26, 2022
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
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