I need to calculate difference between two dates with a fixed 30 days a month logic. The example is shown below
- Start date = 10/4/2018
- End date = 28/10/2018
- Expected number of days between = 199
(Excel calculation of difference of days => 28/10/2018 - 10/4/2018 = 201 which is not what I need) The basis for calculation of difference between two dates is, it should consider number of days in a month as 30 days irrespective of the month. So all months in between the start & end dates with 31 days should be treated as 30 days. If there is Feb in between, it should also be taken as 30 days month.
Procedure to calculate number of days in between two given dates:
- Fraction of days in the starting month = 30/4/2018 - 10/4/2018 = 21 days
- Months in between 1/5/2018 to 30/9/2018 = 5 months = 5 x 30 = 150 days
- Fraction of days in the last month = 28/10/2018 - 1/10/2018 = 28 days
Total days = 21 + 150 + 28 = 199 days.
If A1 is start date cell, B1 = End date cell, please suggest how to do it in excel.
Jan 31 to March 31
, and how does that compare toJan 30 to April 1
orJan 29 to April 2
? – ashleedawg=SUMPRODUCT(--(DAY(ROW(INDIRECT(A2&":"&B2)))<>31))
and I will let you figure out Feb's, Jan 31 and leap year adjustments. – user4039065