Determing number of days

  • Thread starter Thread starter Bridget Stacy
  • Start date Start date
B

Bridget Stacy

I have a spreadsheet with thousands of records that
contain a start date and an end date. I need to determine
the number of days for a particular month that fall within
the start/end dates.

I am using the formula:

=MIN(G4,DATE(YEAR(L4),MONTH(L4)+1,0)) - MAX(F4-1,DATE(YEAR
(L4),MONTH(L4),0))

This works most of the time, however occassionally it
gives a negative number of days. Is there a way to modify
the formula so that if the calculated number of days comes
out to be negative, a zero can be inserted instead?

Thanks in advance.
 
Hi Bridget,

=MAX(0,MIN(G4,DATE(YEAR(L4),MONTH(L4)+1,0)) -
MAX(F4-1,DATE(YEAR(L4),MONTH(L4),0)))

Regards,

Daniel M.
 
Back
Top