Find number of months in a specific year a date has been running?

SkiliedSin

Board Regular
Joined
May 7, 2018
Messages
51
Office Version
  1. 365
Hello all,

I’m trying to find a function that’ll give me how many months a cell has been running for in a specific calendar year disregarding the start date.

For example, for different cells containing start dates 1/1/19 and 1/1/20, I would want to find how many months they were running in 2020. Considering I have columns 1/31/20, 2/28/20 etc through 12/31/20, I am looking for a function that’ll produce 1,2 through 12 for each of those start dates I mentioned earlier.
 
Last edited:

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Glad we could help & thanks for the feedback.

You need to use Joe's formula as mine is wrong. :(
 
Upvote 0
Start Date1/31/20212/28/20213/31/20214/30/20215/31/20216/30/20217/31/20218/31/20219/30/202110/31/202111/30/202112/31/2021
3/1/2017​
0​
0​
1​
2​
3​
4​
5​
6​
7​
8​
9​
10​
1/1/2018​
1​
2​
3​
4​
5​
6​
7​
8​
9​
10​
11​
12​
6/1/2018​
0​
0​
0​
0​
0​
1​
2​
3​
4​
5​
6​
7​

Hello all, I was hoping you guys could help me again. As you can see for the start date 3/1/2017 & 6/1/2018, the function isn't outputting the same numbers as 1/1/2018 which is what I'm looking for here.
 
Upvote 0
What are you expecting to see?
 
Upvote 0
Is this what you mean
+Fluff 1.xlsm
ABCDEFGHIJKLM
1Start Date31/01/202128/02/202131/03/202130/04/202131/05/202130/06/202131/07/202131/08/202130/09/202131/10/202130/11/202131/12/2021
201/03/2017123456789101112
301/01/2018123456789101112
401/06/2018123456789101112
501/06/2021000001234567
Main
Cell Formulas
RangeFormula
B2:M5B2=IF(YEAR($A2)<YEAR(B$1),MONTH(B$1),MAX(MONTH(B$1)-MONTH($A2)+1,0))
 
Upvote 0
I misinterpretted when you said "ignore the start date".
I can see now that you must have meant ignore the "day", but not the "month" or the "year".
 
Upvote 0
Is this what you mean
+Fluff 1.xlsm
ABCDEFGHIJKLM
1Start Date31/01/202128/02/202131/03/202130/04/202131/05/202130/06/202131/07/202131/08/202130/09/202131/10/202130/11/202131/12/2021
201/03/2017123456789101112
301/01/2018123456789101112
401/06/2018123456789101112
501/06/2021000001234567
Main
Cell Formulas
RangeFormula
B2:M5B2=IF(YEAR($A2)<YEAR(B$1),MONTH(B$1),MAX(MONTH(B$1)-MONTH($A2)+1,0))

This is exactly what I'm looking for!

I appreciate you and Joe4 for being so patient with me haha, sorry for the confusion and thank you again!
 
Upvote 0
Glad we could help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,557
Members
449,088
Latest member
davidcom

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