I am building a dashboard to track various things related to team member roles. This includes how many times they lead an event as well as when they support in various functions. I am interested in adding a count of the number of "support roles" for each team member. To accomplish this, I currently use a separate formula with a total COUNTIF that uses "*" wildcards around the name minus the COUNTIF for the times each person Leads (since this is not a support role and is counted in the QUERY function.
=COUNTIF($A$1:$E,"*"&G2&"*")-COUNTIF($A$1:$A,G2)
This means I have to fill the formula when more team members take the lead on events.
A model of this data structure is on the "array" sheet in the following link: https://docs.google.com/spreadsheets/d/1lyCK5eIEQYjGFOxh5T_4BxeuDS-1zvMLq80IYn0dc38/edit#gid=1056844943
K2:K5 have the manual COUNTIF formulas. G8 uses the array of formulas that creates the desired table format (i.e., a COUNTIF formula created within the array set in G8).
={QUERY(A1:E,"select A, count(A) where A is not null group by A label A 'Lead', count(A) 'Total Leads'",1),QUERY(A1:E,"select sum(B) where A is not null group by A label sum(B) 'Total #1'",1),QUERY(A1:E,"select sum(C) where A is not null group by A label sum(C) 'Total #2'",1),{"Total Support Roles";ARRAYFORMULA(COUNTIF((A2:E),QUERY(QUERY(A2:E,"select A, count(A) where A is not null group by A",0),"select Col1 where Col1 is not null",0)))}}
The last subarray includes the ARRAYFORMULA(COUNTIF structure; unfortunately, I cannot successfully use this formula for with partial matches/wild cards as I'm using nested QUERY formulas to dynamically update & match the array size (it also does not include the headers to keep the array size aligned).
=ARRAYFORMULA(COUNTIF((A2:E),QUERY(QUERY(A2:E,"select A, count(A) where A is not null group by A",0),"select Col1 where Col1 is not null",0)))
In my mind, there may be some combination of formulas potentially including SPLIT to create a solution; unfortunately, I have not found one and thus am seeking help. Many thanks for your consideration.
