Count consecutive absences with a limit

R

rhwong

I have an attendance roster for the month and want to count the number of
absences. The problem I am having is that I can only count 5 consecutive
absences at one time. They can have 7 consecutive absences for one period and
then another set of absences for 5 days. That totals to 10 allowed absences
and 2 unallowed absences. How would you run a function to do this calculation
automatically.
 
R

rhwong via OfficeKB.com

Hi Domenic
Here is a sample of the data:
A B C D E F G H I J K L M N
O P Q R S
NAME 1 2 3 4 5 6 7 8 9 10 11 12 13 14
15 Acutal A Expected A Total Present
STUDENT1 X A A A A A A X X X A A A X X
9 8 6
STUDENT2 X X X X A A A A A A A X X X X
7 5 8

A = NAME
B THRU P are the days
Q = actual absenses
R = total expected absences where if more than 5 are consecutive can only
count 5 and continue to count absences for the rest of the month.
S = total present.

Hope this sample helps.
 
D

Domenic

Try...

=SUM(IF(FREQUENCY(IF(B2:p2="A",COLUMN(B2:p2)),IF(B2:p2<>"A",COLUMN(B2:p2)
))<5,FREQUENCY(IF(B2:p2="A",COLUMN(B2:p2)),IF(B2:p2<>"A",COLUMN(B2:p2))),
5))

....confirmed with CONTROL+SHIFT+ENTER, not just ENTER.

Hope this helps!
 
R

rhwong via OfficeKB.com

I get a value error now.
Try...

=SUM(IF(FREQUENCY(IF(B2:p2="A",COLUMN(B2:p2)),IF(B2:p2<>"A",COLUMN(B2:p2)
))<5,FREQUENCY(IF(B2:p2="A",COLUMN(B2:p2)),IF(B2:p2<>"A",COLUMN(B2:p2))),
5))

...confirmed with CONTROL+SHIFT+ENTER, not just ENTER.

Hope this helps!
Hi Domenic
Here is a sample of the data:
[quoted text clipped - 15 lines]
Hope this sample helps.
 
D

Domenic

As mentioned, the formula needs to be confirmed with
CONTROL+SHIFT+ENTER, not just ENTER. In other words, press both the
CONTROL and SHIFT keys down, then while they're both pressed down, press
the ENTER key. Excel will automatically place braces {...} around the
formula indicating that you've entered it correctly.

Hope this helps!

"rhwong via OfficeKB.com" <u26788@uwe> said:
I get a value error now.
Try...

=SUM(IF(FREQUENCY(IF(B2:p2="A",COLUMN(B2:p2)),IF(B2:p2<>"A",COLUMN(B2:p2)
))<5,FREQUENCY(IF(B2:p2="A",COLUMN(B2:p2)),IF(B2:p2<>"A",COLUMN(B2:p2))),
5))

...confirmed with CONTROL+SHIFT+ENTER, not just ENTER.

Hope this helps!
Hi Domenic
Here is a sample of the data:
[quoted text clipped - 15 lines]
Hope this sample helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top