Count Number of Days Between Two Dates


Hi there. I'm trying to count the number of days between two dates, which I was able to figure out. with this formula:

=IF(ISDATE($[Q1 End Date]$1), IF(NETDAYS([Target Service Start Date]@row, $[Q1 End Date]$1) = 0, 1, NETDAYS([Target Service Start Date]@row, $[Q1 End Date]$1)))

Although, this calculation gives me negatives if the [Target Service Start Date] is after [Q1 End Date]. I need it to give me a 0 if it is After [Q1 End Date].

Basically, I only want it to give me the number of days within each quarter. So if [Target Service Start Date] is before Q1 then it would calculate the number of days between [Q1 Start Date] & [Q1 End Date]. If [Target Service Start Date] is within those two dates then it calculates the number of days between [Target Service Start Date] & [Q1 End Date].


Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!