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

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
I have attached an image, highlighting the portion I am looking for.
 

Attachments

  • info.PNG
    info.PNG
    5 KB · Views: 17
Upvote 0
Not sure if I'm missing something, but how about
Excel Formula:
=MONTH(B1)
 
Upvote 0
Not sure if I'm missing something, but how about
Excel Formula:
=MONTH(B1)
Unfortunately, if I changed the date to say 2/1/2020 in A3, I would be looking for a function that'll spit out "1" in C2 rather than "2"
 
Upvote 0
Unfortunately, if I changed the date to say 2/1/2020 in A3, I would be looking for a function that'll spit out "1" in C2 rather than "2"
Personally, I do not understand how exactly you want this to work. The logic is not clear to me.
Why would row 2 (cell C2) be looking at row 3 (cell A3)?

Perhaps it would be better if you post some more sample data, and walk us through a few different scenarios, explaining exactly how you arrive at your expected result for each of them.
 
Upvote 0
But you said to disregard the start date. :confused:

Please post some sample data along with expected results.

MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.
 
Upvote 0
Apologies for the super confusing request, I meant to say that the start month/day matters but to disregard the year to an extent.

I've attached another image showing what I'm looking for, please let me know if this makes any sense.

Edit: As you an see, if you edit the start date, you'll have a different number of months that it was running through.
 

Attachments

  • excel2.PNG
    excel2.PNG
    7.4 KB · Views: 8
Upvote 0
Maybe
Excel Formula:
=MONTH(B$1)-MONTH($A2)+1

In future please post sample data not an image.
 
Upvote 0
Place this in cell B2 and copy to all cells in your grid:
Excel Formula:
=MAX(MONTH(B$1)-MONTH($A2)+1,0)
 
Upvote 0
Solution

Forum statistics

Threads
1,215,438
Messages
6,124,873
Members
449,192
Latest member
MoonDancer

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