# Thread: Calculating months if all days count (DATEDIF) Thanks: 0 Likes: 0

1. ## Calculating months if all days count (DATEDIF)

Hi

I have an issue where I want to count complete months where all days count in the month.

For example if you look at the difference between 2 dates, so 01/01/19 minus 01/01/19 we get 0, but say I want to say someone attended a course on that day, they in fact completed 1 day. So I want the formula to say 1. So I just add 1 in the formula.

Using date dif function on months, if I use say 01/01/19 to 31/1/19 the formula returns 0. In practical terms if I say some attended on these dates, they have completed 1 month, not 'no months'

How can I get a formula to give me the answer of 1 month completed in this scenario...

As another example. so if it was across 01/01/19 - 28/02/19 I would get 2 months, where the formula now gives me 1 month.

Chris

2. ## Re: Calculating months if all days count (DATEDIF)

I don’t know this formula very well, but it seems that someone else had a similar problem with inclusive dates. Perhaps this will help.

https://www.mrexcel.com/forum/excel-...end-dates.html

3. ## Re: Calculating months if all days count (DATEDIF)

Hi. Thanks for this but this solution seems to just sort the days count which I am OK with, its the months

4. ## Re: Calculating months if all days count (DATEDIF)

Maybe just subtract the months and add 1.

 A B C 1 Start Date End Date # Months 2 1/2/2019 1/30/2019 1 3 2/2/2019 4/5/2019 3 4 2/2/2019 3/1/2019 2 5 5/6/2019 5/20/2019 1

 Cell Formula C2 =MONTH(B2)-MONTH(A2)+1

Excel tables to the web >> Excel Jeanie HTML 4

5. ## Re: Calculating months if all days count (DATEDIF)

The formula I gave above would only work if months are in the same year.

 A B C 1 Start Date End Date Months 2 1/1/2019 1/3/2019 1 3 1/8/2019 2/1/2019 2 4 12/6/2018 2/1/2019 3 5 12/4/2018 3/3/2019 4 6 2/2/2019 6/4/2019 5 7 10/5/2017 2/6/2019 17

 Cell Formula C2 =DATEDIF(A2,EOMONTH(B2,0),"m")+1

Excel tables to the web >> Excel Jeanie HTML 4

## User Tag List

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•