apply formula only to data shown after filters applied

misstoffeepenny

New Member
Joined
Jan 18, 2021
Messages
19
Office Version
  1. 365
  2. 2016
  3. 2011
Platform
  1. Windows
Hi, I am trying to develop a matrix that when I apply a series of different filters it will generate counts and calculations based on the data visible. there are over 40 skills to calculate 5 different outputs for.

I have shown a small selection in the mini sheet below. I want to be able to filter by department, site & status and then calculate the values in a6:a10 for each of the labels in row 5. I know this is a complicated ask but any help is much appreciated. This is an ever changing document & skills & staff members will be added constantly so I need the solution to take that into account. The sheet is also linked to other sheets which help to generate this data.

training matrix draft working.xlsx
ABCDEFGHIJKLMNOPQRST
5Staff memberJob RoleSiteStatusCompany InductionRisk AssessmentsSite/Role Specific RAsHR 1HR 2HR 3HR 4HR 5
6Count of Competent Staff per Skill (level 3+)22211111
7Required Count of Competent Staff per Skill (level 3+)33333333
8Competency Gap11122222
9Current Skill Competency %################################
10Target Skill Competency %################################
11Staff MemberDepartmentSiteStatusCTCTCTCTCTCTCTCT
12abcAdministrationDunloyEmployee3343333333333333
13defHRColeraine U5Employee3433331414141414
14ghiFabricatorGarvagh SSEmployee13232333333
15
16
17
18
Matrix
Cell Formulas
RangeFormula
E5E5=IF(Departments!E5<>"",Departments!E5,"")
G5G5=IF(Departments!F5<>"",Departments!F5,"")
I5I5=IF(Departments!G5<>"",Departments!G5,"")
K5K5=IF(Departments!H5<>"",Departments!H5,"")
M5M5=IF(Departments!I5<>"",Departments!I5,"")
O5O5=IF(Departments!J5<>"",Departments!J5,"")
Q5Q5=IF(Departments!K5<>"",Departments!K5,"")
S5S5=IF(Departments!L5<>"",Departments!L5,"")
E6,G6,I6,K6,M6,O6,Q6,S6E6=COUNTIF(E12:E339,">2")
E7,G7,I7,K7,M7,O7,Q7,S7E7=COUNTIF(F12:F339,">2")
E8,G8,I8,K8,M8,O8,Q8,S8E8=E7-E6
E9,G9,I9,K9,M9,O9,Q9,S9E9=((SUM(E12:E339)/COUNT(E12:E339))/4)
E10,G10,I10,K10,M10,O10,Q10,S10E10=((SUM(F13:F340)/COUNT(F13:F340))/4)
F12:F14F12=VLOOKUP(B12,dept,4,FALSE)
H12:H14H12=VLOOKUP(B12,dept,5,FALSE)
J12:J14J12=VLOOKUP(B12,dept,6,FALSE)
L12:L14L12=VLOOKUP(B12,dept,7,FALSE)
N12:N14N12=VLOOKUP(B12,dept,8,FALSE)
P12:P14P12=VLOOKUP(B12,dept,9,FALSE)
R12:R14R12=VLOOKUP(B12,dept,10,FALSE)
T12:T14T12=VLOOKUP(B12,dept,11,FALSE)
Cells with Conditional Formatting
CellConditionCell FormatStop If True
C11:D11Cell Valuecontains "PPC"textNO
C11:D11Cell Value="Garvagh SS"textNO
C11:D11Cell Valuecontains "Garvagh TBF"textNO
C11:D11Cell Value="Magherafelt"textNO
C11:D11Cell Valuecontains "Coleraine U11"textNO
C11:D11Cell Valuecontains "Coleraine U5"textNO
C11:D11Cell Valuecontains "Dunloy"textNO
C3:D3,C12:D1048576,C5:D5Cell Valuecontains "PPC"textNO
C3:D3,C12:D1048576,C5:D5Cell Value="Garvagh SS"textNO
C3:D3,C12:D1048576,C5:D5Cell Valuecontains "Garvagh TBF"textNO
C3:D3,C12:D1048576,C5:D5Cell Value="Magherafelt"textNO
C3:D3,C12:D1048576,C5:D5Cell Valuecontains "Coleraine U11"textNO
C3:D3,C12:D1048576,C5:D5Cell Valuecontains "Coleraine U5"textNO
C3:D3,C12:D1048576,C5:D5Cell Valuecontains "Dunloy"textNO
E12:CH339Cell Value="X"textNO
E12:CH339Cell Value=4textNO
E12:CH339Cell Value=3textNO
E12:CH339Cell Value=2textNO
E12:CH339Cell Value=1textNO
Cells with Data Validation
CellAllowCriteria
B12:B339List=Departments!$B$6:$B$32
C12:C259List=dropdown!$B$3:$B$17
D12:D339List=dropdown!$H$3:$H$5
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Hi misstoffeepenny,

See if the SUBTOTAL function would meet your needs. It works with many functions (COUNT, COUNTA, SUM, AVERAGE, MIN, MAX, etc.) and, for me, summed only visible rows in a Table.

Doug
 
Upvote 0
Hi misstoffeepenny,

See if the SUBTOTAL function would meet your needs. It works with many functions (COUNT, COUNTA, SUM, AVERAGE, MIN, MAX, etc.) and, for me, summed only visible rows in a Table.

Doug
unfortunately this only works if I put the data into a table, which I cannot do as it's all linked to other sheets within the workbook
 
Upvote 0
so I have found this formula online that appears to work except it doesn't give me the correct value which should be 2 not 0
can anyone help me figure out the part I have wrong?

=SUMPRODUCT(SUBTOTAL(3,OFFSET(E12:E339,ROW(E12:E339)-ROW(E12),0,1)),--(E12:E339=">2"))
 
Upvote 0
How about with a helper column using
Excel Formula:
=SUBTOTAL(103,A12)
and then use
Excel Formula:
=COUNTIFS(E12:E339,">2",U12:U339,1)
Change col U to the column with the subtotal formula
 
Upvote 0
got it sorted thanks
just had to amend the formula to:

=SUMPRODUCT(SUBTOTAL(3,OFFSET(E12:E339,ROW(E12:E339)-ROW(E12),0,1)),--(E12:E339>2))
 
Upvote 0
Solution
Did you try what I suggested? It's more efficient & non volatile.
 
Upvote 0

Forum statistics

Threads
1,223,712
Messages
6,174,031
Members
452,542
Latest member
Bricklin

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