Number of last days of the month between 2 dates

JoshLyman

New Member
Joined
Jan 11, 2023
Messages
35
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
I'm sure this is very easy to achieve, but my brain is failing me. Essentially I need to calculate the number of times the last day of the month has been reached between 2 dates. I've tried using DATEDIF but it's not working as I expected and is giving me different results if the day of the month for the second date is before the day of the month of the first;

e.g.,

1673459001136.png


In the above example, I want it always say 12. Unless date 2 is that last day of the month, in which case I want it to say 13.
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Hi & welcome to MrExcel.
How about
Fluff.xlsm
KLM
1
215/01/202302/01/202412
308/01/202331/01/202413
415/01/202309/01/202412
Main
Cell Formulas
RangeFormula
M2:M4M2=DATEDIF(K2,EOMONTH(L2,0),"m")+(L2=EOMONTH(L2,0))
 
Upvote 0
Solution
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,929
Messages
6,122,314
Members
449,081
Latest member
tanurai

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top