Count 52 qualifying rows out of 104 then move on to next set of 104 rows

New Contributor

I have a spreadsheet that lists staff pay by week for 104 weeks
Each week is on a different line so there are 104 lines for each staff member
Some weeks are qualifying for holiday and some are not
I have marked each row with a Q if it is qualifying.
For each member of staff I want to count the values in the row e.g total pay if it is qualifying until I get 52 weeks.
Then I want to total the data for example total pay or total hours for those 52 weeks and then move onto the next member of staff ignoring any other weeks.
Hope this makes sense and hoping someone can point me in correct direction.

The attached file has roughly 1000 lines as examples but original has 34,000 so solution needs to take that into account.

Thanks in advance

2 Replies
I should have said it is column AA to AG in spreadsheet that are the rows to count. Thanks
Further clarification on version uploaded it is column U to AA