Using EOMONTH to calculate number of hours between dates

Allen_Mead

New Member
Joined
May 31, 2019
Messages
36
Office Version
  1. 365
Platform
  1. Windows
Hi, I need to calculate the number of CPD hours I have worked over the previous 24 months (or in fact any number of months) in a rolling period in total. This also needs to be split down into 2 12 month periods ie. the immediate previous 12 months and the 12 month period behand that. i.e. 31/12/2024 - 31/01/2024 and 31/12/2023 - 31/01/2023.

In the attached spreadsheet, there is a summary sheet with 3 summaries and a data tab.

Summary 1 will let me put in any number of months and will calculate the number of hours over that total period, perfect.
Summary 2 will let me calculate the previous 12 month period, perfect.
Summary 3 will let me calculate the previous 12 month period to Summary 2 but, there's an error somewhere as there are not 13 hours in this time period and this is getting me stuck.

Hopefully the above makes sense. More that welcome to adjust the summary page to something a little less clumsy. Data Tab information included in the second post on the thread.

CPD Chart.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXY
1
2Summary 1Summary 2Summary 3
3
4Get CPD hours for the last24MonthsGet CPD hours for the last12MonthsGet CPD hours for the previous24Months
5
6Date RangeDate RangeDate Range
7
8Start31/01/2023Start31/01/2024Start31/01/2023
9
10End31/12/2024End31/12/2024End31/12/2023
11
12Number of CPD hours in a rolling 24 month period13Number of CPD hours in a rolling 12 month period3Number of CPD hours in a rolling 24 month period13
13
14
15
16Total number of CPD hours20Total number of CPD hours0Total number of CPD hours0
17
18
19
Summary
Cell Formulas
RangeFormula
G8,W8,O8G8=EOMONTH(TODAY(),-(G4-1))
G10G10=EOMONTH(TODAY(),0)
O10,W10O10=EOMONTH(TODAY(),-(O4-12))
E12,U12,M12E12="Number of CPD hours in a rolling " & TEXT(G4,"##") &" month period"
G12,W12,O12G12=SUM(XLOOKUP(G8,'CPD Data'!$C$2:$FB$2,'CPD Data'!$C$3:$FB$340,0):XLOOKUP(EOMONTH(TODAY(),0),'CPD Data'!$C$2:$FB$2,'CPD Data'!$C$3:$FB$340,0))
G16,W16,O16G16='CPD Data'!B341
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
CPD Chart.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJAKALAMANAOAPAQARASATAUAVAWAXAYAZBABBBCBDBEBFBGBHBIBJBKBLBMBNBOBPBQBRBSBTBUBVBWBXBYBZCACBCCCDCECFCGCH
1
2CPD EventDate31/01/201828/02/201831/03/201830/04/201831/05/201830/06/201831/07/201831/08/201830/09/201831/10/201830/11/201831/12/201831/01/201928/02/201931/03/201930/04/201931/05/201930/06/201931/07/201931/08/201930/09/201931/10/201930/11/201931/12/201931/01/202028/02/202031/03/202030/04/202031/05/202030/06/202031/07/202031/08/202030/09/202031/10/202030/11/202031/12/202031/01/202128/02/202131/03/202130/04/202131/05/202130/06/202131/07/202131/08/202130/09/202131/10/202130/11/202131/12/202131/01/202228/02/202231/03/202230/04/202231/05/202230/06/202231/07/202231/08/202230/09/202231/10/202230/11/202231/12/202231/01/202328/02/202331/03/202330/04/202331/05/202330/06/202331/07/202331/08/202330/09/202331/10/202330/11/202331/12/202331/01/202429/02/202431/03/202430/04/202431/05/202430/06/202431/07/202431/08/202430/09/202431/10/202430/11/202431/12/2024
3Protecting High-rise Residential Buildings from Fire31/03/20211
4Built Environment Monthly Webinar - The Golden Thread of information and what it eans for the sector21/04/20211
5Bridging the gap between fire and emergency lighting systems10/06/20211
6Bureau Veritas - Building Safety Bill Seminar17/09/20211
7Class 0 Conumdrum13/04/20221
8The Key Essentials of Water Mist Fire Protection01/07/20221
9Asbestos Awareness UKI - Module 1 AECOM University17/08/20221
10BSI/IFE Collaborative Reporting for Safer Structures23/08/20221
11Design of car park smoke contorl systems04/10/20221
12BSI/IFE Understanding Planning Gateway One (PGO): What you need to know28/02/20231
13Fire Safety requirements and the role of the fire engineer through the gateways27/06/20231
14BSI/ IFE Fire Testing: Concepts, Principles and Innovation26/09/20231
15BSI/ IFE Evacuation lift design in fire engineering31/10/20231
16Fire Safety in Construction - What's Next?21/11/20234
17Coopers Fire CPD on Active Fire Curtain Barriers12/12/2023
18AECOM University - The Building Safety Act15/12/20231
19AECOM University - EUR&I Driving Awareness Course - FY2420/12/20231
20Bsi - Review of 2023 and looking forward to 202430/01/20241
21Demystifying the Golden Thread of the Building Safety Act01/02/20241
22Residential Smoke Control Overview19/12/20241
CPD Data
 
Upvote 0
W12: =SUM(XLOOKUP(W8,'CPD Data'!$C$2:$FB$2,'CPD Data'!$C$3:$FB$340,0):XLOOKUP(EOMONTH(TODAY(),0),'CPD Data'!$C$2:$FB$2,'CPD Data'!$C$3:$FB$340,0))

should be

=SUM(XLOOKUP(W8,'CPD Data'!$C$2:$FB$2,'CPD Data'!$C$3:$FB$340,0):XLOOKUP(W10,'CPD Data'!$C$2:$FB$2,'CPD Data'!$C$3:$FB$340,0))

And your StartDate formula in W8 should be: =EOMONTH(TODAY(),-(O4+W4-1))
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,155
Members
453,021
Latest member
Justyna P

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