Multiple Group Attendance Percentage

Juddman79

New Member
Joined
Feb 17, 2020
Messages
31
Office Version
  1. 2016
Platform
  1. Windows
Hi all,

I'm wondering is it possible to work out a percentage of group attendance for 2 different groups (S and SC) that run either in the morning (AM) or afternoon (PM) throughout the week? Not every person is scheduled to attend every session but if we are expecting them then their attendance would be marked with a 'Y' or 'N' on the sheet. If we are not expecting them then the cell is left blank.

Is there a formula/code to get a percentage of the expected attendance for both types of groups for the week if they either run in the morning or afternoon. Basically 4 different percentages totals (Cells W14 - Z14)

I hope that makes sense.

Also, just as a quick second question is there also a formula or code to auto capitalise the range of cells which will be populated with a 'Y' or 'N' in them?

Thanks in advance
 

Attachments

  • Test ss.png
    Test ss.png
    52.1 KB · Views: 38

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
At the bottom of each column - G40 =countif(G14:G38,"Y") G41 (countif(G14:G38,"*"). And then for the rest of the row.

W14 = (sumifs(range with count Y,G12:T12,"S",G11:T11,"AM"))/(sumifs(range with count "*",G12:T12,"S",G11:T11,"AM")). Format W14 as a percentage.
 
Upvote 0
At the bottom of each column - G40 =countif(G14:G38,"Y") G41 (countif(G14:G38,"*"). And then for the rest of the row.

W14 = (sumifs(range with count Y,G12:T12,"S",G11:T11,"AM"))/(sumifs(range with count "*",G12:T12,"S",G11:T11,"AM")). Format W14 as a percentage.
Thank you so much, works great.

Just wondering is there a way to add to the formula to stop the #DIV/0! error if there is a no data in row 12 and the range G14:T41?

=(SUMIFS(G40:T40,G12:T12,"S",G11:T11,"AM"))/(SUMIFS(G41:T41,G12:T12,"S",G11:T11,"AM"))
 
Last edited:
Upvote 0
Can you send an example of what you are dealing with?

Thanks, here is a link to the sheet.

 
Upvote 0
Thanks, here is a link to the sheet.

You can't divide by zero. On the sheet you've sent, there's no class for S in the AM. Hence the zero and the divide by zero, which can't be done. SO I would just "wrap the formula in an IfError function. Do all 4 from W13 to Z13. The formulas will look like this:

=IFERROR((SUMIFS(G40:T40,G12:T12,"S",G11:T11,"AM"))/(SUMIFS(G41:T41,G12:T12,"S",G11:T11,"AM")),"No attendance in the AM slot")

"No attendance in the AM slot" can say anything you want, or nothing at all. Leave it as a "" if you wish.
 
Upvote 0
Thanks, here is a link to the sheet.

Actually, I've thought of a better solution. Follow these steps:
1. Row 40 is the summation of actual ("Y") in the various columns ie G40 = COUNTIF(G14:G38,"Y")
2. Row 41 is the summation of possible ("*") in the various columns ie G41` = COUNTIF(G14:G38,"*")
3. Row 42 is the calculation of percentages for each column: G42 = IFERROR(G40/G41,"") wrapped in the iferror
4. For W14, W14=AVERAGEIFS(G43:T43,G11:T11,"AM",G12:T12,"S")

Is that more like what you need?
 
Upvote 1
Actually, I've thought of a better solution. Follow these steps:
1. Row 40 is the summation of actual ("Y") in the various columns ie G40 = COUNTIF(G14:G38,"Y")
2. Row 41 is the summation of possible ("*") in the various columns ie G41` = COUNTIF(G14:G38,"*")
3. Row 42 is the calculation of percentages for each column: G42 = IFERROR(G40/G41,"") wrapped in the iferror
4. For W14, W14=AVERAGEIFS(G43:T43,G11:T11,"AM",G12:T12,"S")

Is that more like what you need?
Thank you ever so much for your help, everything works great.
 
Upvote 0
Thank you ever so much for your help, everything works great.
You're welcome. Just remember to tick the heart symbol on the left for your preferred answer if you feel that your question has been answered.
 
Upvote 0

Forum statistics

Threads
1,224,826
Messages
6,181,192
Members
453,021
Latest member
pingpong7117

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