Count values, only if within the past 12 months over several columns

queysoft

New Member
Joined
Aug 3, 2021
Messages
49
Office Version
  1. 2016
Platform
  1. Windows
Hi - First post to this forum as I am just stuck on this...........Its a simple table to show employees leave. I have a list of names down one side and then the same headers repeated and then just populated as people go on leave.

Column A = Date of Leave 1
Column B = Date of Return 1
Column C = Number of actual days away
Column D = Number of working days away

Column E onwards will show the same as A to D but for all the other days away (if there are any). So, for one employee I might have 5 different leave return dates and for another perhaps only 1.

I am trying to construct a formula to show the SUM value of column D plus all the other columns (so H, L......n) only if the date of leave and return falls in the last 12 months.

So - In essence I want a rolling number of days leave every time I open the spreadsheet.

In the attached example, only cells H2 and L2 would be counted.

Any ideas?
 

Attachments

  • help_1.JPG
    help_1.JPG
    42.5 KB · Views: 26
What if the Start and End Date of the leave straddles the rolling 12 month date? Like below in column A and B? Column U doesn't include any portion of this leave.

Am I missing something?

Book4
ABCDEFGHIJKLMNOPQRSTU
1StartEndDaysWorking DaysStartEndDaysWorking DaysStartEndDaysWorking DaysStartEndDaysWorking DaysStartEndDaysWorking DaysLast 12 Months Working Days Off
28/1/20208/15/20201095/20/20215/30/20211077/20/20207/30/20201091/1/20191/2/2019121/1/20191/2/2019127
Sheet1
Cell Formulas
RangeFormula
U2U2=SUMIFS(D2,A2,">="&EDATE(TODAY(),-12),B2,">="&EDATE(TODAY(),-12))+SUMIFS(H2,E2,">="&EDATE(TODAY(),-12),F2,">="&EDATE(TODAY(),-12))+SUMIFS(L2,I2,">="&EDATE(TODAY(),-12),J2,">="&EDATE(TODAY(),-12))+SUMIFS(P2,M2,">="&EDATE(TODAY(),-12),N2,">="&EDATE(TODAY(),-12))+SUMIFS(T2,Q2,">="&EDATE(TODAY(),-12),R2,">="&EDATE(TODAY(),-12))
 
Upvote 0

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.

Forum statistics

Threads
1,215,004
Messages
6,122,656
Members
449,091
Latest member
peppernaut

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