Calculate total number of Days between 2 dates

You can have scenarios where you would want to calculate the number of days between two dates. For example, when you want to find out the number of days taken by a Sales representative from lead generation to lead conversion date. Or say the number of days from when a product has been launched after improvements for further analysis.

You can use the RANGE function get the days in a given range and then take a COUNT of the dates in the range to find the array.

Formula

Using UnixTime

COUNT( RANGE( EXCELTIME( unixdatetime1) , EXCELTIME( unixdatetime2))) - 1

Where input - unixdatetime1 & unixdatetime2 are datetime control or unix value

Using Date object

COUNT( RANGE( EXCELTIME(STRTOUNIX(DATESTR(date1,“MM/DD/YYYY”),“MM/DD/YYYY”)) , EXCELTIME(STRTOUNIX(DATESTR(date2,“MM/DD/YYYY”),“MM/DD/YYYY”)))) - 1

Where input date1 and date2 are Date object