Complicated SUMIFS/COUNTIFS Formulas Required

Rob_010101

Board Regular
Joined
Jul 24, 2017
Messages
198
Office Version
  1. 365
Platform
  1. Windows
Hello,

I have two sheets, named:

1. Master Data - This sheet will be updated daily by pasting a system report over the existing data
2. 2022 - I want to calculate some stats from the master data sheet on this sheet

The gist of this is, I need to report on people who leave between 0 and 5 months (under 6 months) of employment.

Master Data (Anonymised)
Chris Ops - Attrition Report (ANONYMISED).xlsm
ABCDEFGHIJKLMN
1Employee ID (8 Digit)Employee NameEmployee Reference CodeStatusEmployee First NameEmployee SurnameHire dateTermination DateJobDepartmentLocationTermination TypeTermination ReasonMonths Employed
200000001Jimmy Carr1TerminatedJimmyCarr01/01/202201/02/2022Manager ComicTVSt AlbansResignationVoluntary1
300000002Rob Beckett2TerminatedRobBeckett25/04/202224/10/2022ComicStageWheathampsteadDismissalInvoluntary5
400000003Rob Brydon3TerminatedRobBrydon01/01/202301/01/2023Manager ComicTheatreHarpendenDid not StartVoluntary0
500000004Jack Whitehall4TerminatedJackWhitehall01/01/201931/12/2022Funny PersonTVAmwellResignationVoluntary47
600000005John Richardson5TerminatedJohnRichardson09/01/202231/12/2022Manager ComicStageGustard WoodDismissalInvoluntary11
700000006Sean Lock6TerminatedSeanLock31/12/202231/12/2022Manager ComicTheatreLamer WoodDid not StartVoluntary0
800000007Bob Mortimer7TerminatedBobMortimer01/01/201819/05/2018ComedianTVKimptonResignationVoluntary4
Master Data
Cell Formulas
RangeFormula
A2:A8A2=IF(OR(ISBLANK(C2)), "", REPT(0,8-LEN(C2))&C2)
B2:B8B2=IF(OR(ISBLANK(C2)),"",CONCATENATE(E2," ",F2))
N2:N8N2=IFERROR(IF(OR(ISBLANK(C2)), "", DATEDIF(G2, H2, "M")), "0")


2022 (Anonymised)
Chris Ops - Attrition Report (ANONYMISED).xlsm
ABCDEFGHIJKLM
12022 - Total Early Churn By Location
2LocationJan-22Feb-22Mar-22Apr-22May-22Jun-22Jul-22Aug-22Sep-22Oct-22Nov-22Dec-22
3St Albans
4Wheathampstead
5Harpenden
6Amwell
7Gustard Wood
8Lamer Wood
9Kimpton
10Total            
11
122022 - Total Early Churn By Department
13DepartmentJan-22Feb-22Mar-22Apr-22May-22Jun-22Jul-22Aug-22Sep-22Oct-22Nov-22Dec-22
14TV
15Stage
16Theatre
17Total
18
192022 - Total Early Churn By Role
20RoleJan-22Feb-22Mar-22Apr-22May-22Jun-22Jul-22Aug-22Sep-22Oct-22Nov-22Dec-22
21Manager Comic
22Comic
23Funny Person
24Comedian
25Total            
2022
Cell Formulas
RangeFormula
B10:M10B10=IF(SUM(B3:B9)=0, "", SUM(B3:B9))
B25:M25B25=IF(SUM(B21:B24)=0,"",SUM(B21:B24))

Stat 1 - total early churn by location

I need to know (numeric) how many people based in location X, who left employment (terminated) in month X (in 2022 only), had between 0 and 5 months employment.

The "total" row is not necessary, just the rows above.

I think stat 2 and 3 I will be ok with as I can amend accordingly, once I have the formula for the above (unless unbeknown to me otherwise!).

Chris
 

Attachments

  • 1684595707882.png
    1684595707882.png
    37.8 KB · Views: 14
  • 1684595716583.png
    1684595716583.png
    37.8 KB · Views: 15

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
does this work for you

location
=COUNTIFS('Master Data'!$N$2:$N$8,"<="&5,'Master Data'!$H$2:$H$8,">="&'2022'!B$2,'Master Data'!$H$2:$H$8,"<="&EOMONTH(B$2,0),'Master Data'!$K$2:$K$8,'2022'!$A3)

department
=COUNTIFS('Master Data'!$N$2:$N$8,"<="&5,'Master Data'!$H$2:$H$8,">="&'2022'!B$13,'Master Data'!$H$2:$H$8,"<="&EOMONTH(B$13,0),'Master Data'!$J$2:$J$8,'2022'!$A14)

role
=COUNTIFS('Master Data'!$N$2:$N$8,"<="&5,'Master Data'!$H$2:$H$8,">="&'2022'!B$20,'Master Data'!$H$2:$H$8,"<="&EOMONTH(B$20,0),'Master Data'!$I$2:$I$8,'2022'!$A21)

Book10
ABCDEFGHIJKLM
12022 - Total Early Churn By Location
2Location1/1/222/1/223/1/224/1/225/1/226/1/227/1/228/1/229/1/2210/1/2211/1/2212/1/22
3St Albans010000000000
4Wheathampstead000000000100
5Harpenden000000000000
6Amwell000000000000
7Gustard Wood000000000000
8Lamer Wood000000000001
9Kimpton000000000000
10Total 1       1 1
11
122022 - Total Early Churn By Department
13Department1/1/222/1/223/1/224/1/225/1/226/1/227/1/228/1/229/1/2210/1/2211/1/2212/1/22
14TV010000000000
15Stage000000000100
16Theatre000000000001
17Total
18
192022 - Total Early Churn By Role
20Role1/1/222/1/223/1/224/1/225/1/226/1/227/1/228/1/229/1/2210/1/2211/1/2212/1/22
21Manager Comic010000000001
22Comic000000000100
23Funny Person000000000000
24Comedian000000000000
25Total 1       1 1
2022
Cell Formulas
RangeFormula
B3:M9B3=COUNTIFS('Master Data'!$N$2:$N$8,"<="&5,'Master Data'!$H$2:$H$8,">="&'2022'!B$2,'Master Data'!$H$2:$H$8,"<="&EOMONTH(B$2,0),'Master Data'!$K$2:$K$8,'2022'!$A3)
B10:M10B10=IF(SUM(B3:B9)=0, "", SUM(B3:B9))
B14:M16B14=COUNTIFS('Master Data'!$N$2:$N$8,"<="&5,'Master Data'!$H$2:$H$8,">="&'2022'!B$13,'Master Data'!$H$2:$H$8,"<="&EOMONTH(B$13,0),'Master Data'!$J$2:$J$8,'2022'!$A14)
B21:M24B21=COUNTIFS('Master Data'!$N$2:$N$8,"<="&5,'Master Data'!$H$2:$H$8,">="&'2022'!B$20,'Master Data'!$H$2:$H$8,"<="&EOMONTH(B$20,0),'Master Data'!$I$2:$I$8,'2022'!$A21)
B25:M25B25=IF(SUM(B21:B24)=0,"",SUM(B21:B24))
 
Upvote 0
Solution
does this work for you

location
=COUNTIFS('Master Data'!$N$2:$N$8,"<="&5,'Master Data'!$H$2:$H$8,">="&'2022'!B$2,'Master Data'!$H$2:$H$8,"<="&EOMONTH(B$2,0),'Master Data'!$K$2:$K$8,'2022'!$A3)

department
=COUNTIFS('Master Data'!$N$2:$N$8,"<="&5,'Master Data'!$H$2:$H$8,">="&'2022'!B$13,'Master Data'!$H$2:$H$8,"<="&EOMONTH(B$13,0),'Master Data'!$J$2:$J$8,'2022'!$A14)

role
=COUNTIFS('Master Data'!$N$2:$N$8,"<="&5,'Master Data'!$H$2:$H$8,">="&'2022'!B$20,'Master Data'!$H$2:$H$8,"<="&EOMONTH(B$20,0),'Master Data'!$I$2:$I$8,'2022'!$A21)

Book10
ABCDEFGHIJKLM
12022 - Total Early Churn By Location
2Location1/1/222/1/223/1/224/1/225/1/226/1/227/1/228/1/229/1/2210/1/2211/1/2212/1/22
3St Albans010000000000
4Wheathampstead000000000100
5Harpenden000000000000
6Amwell000000000000
7Gustard Wood000000000000
8Lamer Wood000000000001
9Kimpton000000000000
10Total 1       1 1
11
122022 - Total Early Churn By Department
13Department1/1/222/1/223/1/224/1/225/1/226/1/227/1/228/1/229/1/2210/1/2211/1/2212/1/22
14TV010000000000
15Stage000000000100
16Theatre000000000001
17Total
18
192022 - Total Early Churn By Role
20Role1/1/222/1/223/1/224/1/225/1/226/1/227/1/228/1/229/1/2210/1/2211/1/2212/1/22
21Manager Comic010000000001
22Comic000000000100
23Funny Person000000000000
24Comedian000000000000
25Total 1       1 1
2022
Cell Formulas
RangeFormula
B3:M9B3=COUNTIFS('Master Data'!$N$2:$N$8,"<="&5,'Master Data'!$H$2:$H$8,">="&'2022'!B$2,'Master Data'!$H$2:$H$8,"<="&EOMONTH(B$2,0),'Master Data'!$K$2:$K$8,'2022'!$A3)
B10:M10B10=IF(SUM(B3:B9)=0, "", SUM(B3:B9))
B14:M16B14=COUNTIFS('Master Data'!$N$2:$N$8,"<="&5,'Master Data'!$H$2:$H$8,">="&'2022'!B$13,'Master Data'!$H$2:$H$8,"<="&EOMONTH(B$13,0),'Master Data'!$J$2:$J$8,'2022'!$A14)
B21:M24B21=COUNTIFS('Master Data'!$N$2:$N$8,"<="&5,'Master Data'!$H$2:$H$8,">="&'2022'!B$20,'Master Data'!$H$2:$H$8,"<="&EOMONTH(B$20,0),'Master Data'!$I$2:$I$8,'2022'!$A21)
B25:M25B25=IF(SUM(B21:B24)=0,"",SUM(B21:B24))
Hi There,

Thanks for this.

Unfortunately not, when I add these formulas into my other sheet, where the master data contains about 10,000 rows, it's showing all 0's. I've tried adding 10000 rows in place of 8 on the criteria but this hasn't changed it.

Kind Regards
Chris
 
Upvote 0
Hi

Also in your sheet, the months in the header seem to be replaced by dates, 1st Jan to 12 Jan. Could this be a problem?

Unless in American date format?

Kind Regards,
Chris
 
Upvote 0
you are welcome ,
I dont think XL2BB copes very well with dates - when i bring into excel sometimes I get text in US format
 
Upvote 1

Forum statistics

Threads
1,223,884
Messages
6,175,174
Members
452,615
Latest member
bogeys2birdies

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