Calculate Number of Project's Months that Occur within a Certain Year

Neuner

New Member
Joined
Jul 18, 2018
Messages
18
Need help with calculating the number of months that occur within a particular year for each project. To make it easier for anyone entering information, I only have them enter the Start Year and the Start Month. It then needs to calculate out for each year, i.e: 2020, 21, 22, etc. I can get it to easily calculate for the current year but not sure how to get it to calculate only for a later year. So far my efforts also produce errors for 2021. Project A should be 6 months and Project B 5 months for 2021.

As time progresses, we will need to copy the last column and add on the following year to keep track.

I included the 12/31 and 1/1 dates at the top of the columns to try and help me figure this out but I've had no luck and not sure if they are needed.

Tried using XL2BB but it wouldn't paste correctly so I created a table to hopefully help. I can upload the file if needed and allowed.

12/31/202012/31/202112/31/202312/31/2023
1/1/20191/1/20211/1/20231/1/2023
duration (months)start yearstart monthstart dateend date2020202120222023
Project A12202066/1/20206/1/202165
Project B9202088/1/20205/1/202144
Project C11202133/1/20212/1/2022
Project D21202177/1/20214/1/2023


Thank you!
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
On project B, you say that 2020 has 4 months and 2021 has 4 months.
Should that not be 5+4 months? (8+9+10+11+12 1+2+3+4)
 
Upvote 0
=IF(YEAR($E4)>G$3,0,IF(YEAR($F4)<G$3,0,IF(AND(YEAR($E4)<G$3,YEAR($F4)>G$3),12,IF(AND(YEAR($E4)=G$3,YEAR($F4)=G$3),MONTH($F4)-MONTH($E4)+1,IF(AND(YEAR($E4)<G$3,YEAR($F4)=G$3),MONTH($F4)-1,12-MONTH($E4)+1)))))
 
Upvote 0
Another option:
This formula in column "2020"
=IF(YEAR($E15)=G$14,MIN(12-MONTH(E15)+1,$B15),0)

And this formula in the following columns:
=IF(AND(SUM($G15:G15)<$B15,SUM($G15:G15)>0),MIN($B15-SUM($G15:G15),12),IF(YEAR($E15)=H$14,MIN(12-MONTH(E15)+1,$B15,12),0))
 
Upvote 0
YES!! Thank you very much. I'm using the equation you have in post #3 and works perfectly. Much appreciated.
 
Upvote 0

Forum statistics

Threads
1,215,055
Messages
6,122,902
Members
449,097
Latest member
dbomb1414

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