简体   繁体   中英

Count num of values within range on every Nth cell

We have a data-set generated by an HR system of staff times, which isn't in the most helpful of formats.

We need to count the # of staff who start work before 10.00, and split those counts by week number (1-4) and day (Sun-Sat).

Every group of rows (1-4) is an individual.

Here's an example day's data: Week Start 1 - 2 10:00 3 09.00 4 09.55 1 09:25 2 10.00 3 10:25 4 10.25 1 09:25 2 09.55 3 08:00 4 10.00 1 10:25 2 09.25 3 09:25 4 10.15 1 10.00 2 08:25 3 09.45 4 11:25

So I can count the occurence of start times before 10am on the entire column with:

=COUNTIFS(L5:L203,">=00:30",L5:L203,"<=10:00")

but to do separate counts for every 4th row (so sum all for ones on week 1, all on week 2, etc) is beyond me.

I tried the following after searching similar questions, but it didn't work:

=COUNTIFS((MOD(ROW(L5:L203),5)=0),">=00:30",(MOD(ROW(L5:L203),5)=0),"<=10:00")

Ideally I'd be able to put values into a table with a count for week 1 on Sunday, week 2 on Sunday, week 1 on Monday, and so on.

Any ideas?

To count the weeks use:

=COUNTIFs(B$2:B$21,"<=10:00",$A$2:$A$21,"=1")

=COUNTIFs(B$2:B$21,"<=10:00",$A$2:$A$21,"=2")

Changing =1, =2, =3, =4 for each weeks count. If column B is Monday and column C is Tuesday, you can drag the above formulas right across the row to get the weekly counts for other days.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM