Formula to determine number of months between two dates

Mldeuser

Well-known Member
Joined
Dec 27, 2008
Messages
534
Hello

I am trying to write a formula that will first determine the the date in cell A4 is greater than the date on cell E14 and less than the date in cell F14. If true I would like it to calculate the number of months between the two dates.

Date is cell A4 = 10/31/20
Date in cell E14 = 10/01/20
Date in cell F14 = 12/31/20

In this case it would need to return 1, next month when the date in cell A4 changes to 11/30/20 then return 2 and so on. otherwise return 0.

Thank you
 

Some videos you may like

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
53,239
Office Version
  1. 365
Platform
  1. Windows
How about
Excel Formula:
=IF(AND(A4>E14,A4<F14),MONTH(A4)-MONTH(E14)+1,0)
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
53,239
Office Version
  1. 365
Platform
  1. Windows
You're welcome & thanks for the feedback.
 

Watch MrExcel Video

Forum statistics

Threads
1,123,206
Messages
5,600,302
Members
414,375
Latest member
Onmyown

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
Top