Analysing Data According to day of the week.

CaptainMarvel4

New Member
Joined
Oct 17, 2024
Messages
3
Office Version
  1. 2021
Platform
  1. Windows
I would like to be able to set up a spreadsheet that automatically calculates averages and percentages according to numbers that are put in cells under each day of the week. I am currently using countif formulae, but have to manually expand the range every time a new week passes. The columns i have set up are (see image below):
Names in Cells A, Then dates and days of the week across the top. The numbers placed in them are 1-6. I want to automatcially calculate how many 1s take place for each person on each day of the week to analyse for patterns.

I hope I have explained this well enough. I appreciate any help that can be offered.

1729165417498.png

1729165506507.png
 

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.
You have not shown column or row headings in your screenshot so I will guess that the "Name" cell is A1, and the name of the sheet is Sheet1.

I don't know what's in row 1 so I am going to have to assume that the days of the week are displayed using the TEXT function based on the dates in row 2.

You don't show any formulas in the second grid so I'll assume you don't have any yet, and you just typed in numbers to illustrate what you want. And again, no headers, so I am going to treat it as though it's on another sheet and the blank upper-left gray cell is A1.

You said "for each person" so I am assuming that means you want a separate grid for totals for each person.

For the Monday/1 cell (which is B2), for the first name:
Excel Formula:
=COUNTIFS(Sheet1!4:4,B$1,Sheet1!$1:$1,$A2)
Then copy to the rest of the grid. Then make a copy of the grid and change 4:4 to 6:6 for the next name, and so forth.

If this doesn't help then please give a more complete description of what your data is, what your formulas are, and what your sheet layout is.
 
Upvote 0
You have not shown column or row headings in your screenshot so I will guess that the "Name" cell is A1, and the name of the sheet is Sheet1.

I don't know what's in row 1 so I am going to have to assume that the days of the week are displayed using the TEXT function based on the dates in row 2.

You don't show any formulas in the second grid so I'll assume you don't have any yet, and you just typed in numbers to illustrate what you want. And again, no headers, so I am going to treat it as though it's on another sheet and the blank upper-left gray cell is A1.

You said "for each person" so I am assuming that means you want a separate grid for totals for each person.

For the Monday/1 cell (which is B2), for the first name:
Excel Formula:
=COUNTIFS(Sheet1!4:4,B$1,Sheet1!$1:$1,$A2)
Then copy to the rest of the grid. Then make a copy of the grid and change 4:4 to 6:6 for the next name, and so forth.

If this doesn't help then please give a more complete description of what your data is, what your formulas are, and what your sheet layout is.

Thank you for your reply:

All of these cells are simply manual entry (bar the average calculation):

1729173583023.png


This table is just created within the sheet:

1729173630220.png


The cell with the value 26 in it is created from the formula

=COUNTIF($E$4:$E$18,"1")+COUNTIF($J$4:$J$18,"1")+COUNTIF($O$4:$O$18,"1")+COUNTIF($T$4:$T$18,"1")+COUNTIF($Y$4:$Y$18, "1")

I have asked it to count all the number ones, for all of the people, in all of the cells that corresponding to Mondays

The Cell undernreath with the value 18 in it, is created from the formula:

=COUNTIF($F$4:$F$18, "1")+COUNTIF($K$4:$K$18, "1")+COUNTIF($P$4:$P$18,"1")+COUNTIF($U$4:$U$18, "1")+COUNTIF($Z$4:$Z$19, "1")

I have asked it to count all the number ones, for all of the people, in all of the cells that corresponding to Tuesdays

When new data is added for each day, I then have to manually change the range with a new '=countif' range and I would like to be able to have that process automated, so that when a new set of 'Monday data' is added, it automatcially calculates the total in the Weekly analysis box (The one with Monday to Friday and with 1 - 6 listed)


I have another separate table in the sheet that counts the numbers for each person:

The value of 15 for Person A has a formula of =COUNTIF($C$4:$AD$4,("1"))
1729174078866.png


I don't know how to do a table with Person A that can calculte the frequency of 1s, 2s, and 3s on specific days - if that is possible it would save me a huge amount of time.
 
Upvote 0
I don't know how to do a table with Person A that can calculte the frequency of 1s, 2s, and 3s on specific days - if that is possible it would save me a huge amount of time.
That's exactly what the formula does that I provided. You just have to review my assumptions and make any changes for assumptions that are violated.
 
Upvote 0
Thank you for your help - I feel completely out of my league in trying to understand it properly. I have tried to use the formula you provided but I can't get it to work. Here is the sheet in full so you can see what I am trying to achieve:

In Cell H22 I am trying to get it to add all the 1s that happen on Mondays in the range c4:ad18 (but this will grow when new dates and adat are added; in cell I22 I am trying to get it to add all the 2s that happen on Mondays etc etc

In Cell C30, I am trying to get it to add all the 1s that happen on Mondays for a person whose name will be in B30 and A4 and linked to the data information in row 4. I am hoping that the formula will automatically calculate the new data as it is added each each.

Thank you for your patience.

1729505472575.png
 
Upvote 0
Here are a couple of options. None of them are super elegant, but they all get the job done. Note that option A and C will need to be modified if new people are added, but won't need to be modified for extra dates. Option B will require the formulas in the helper rows to be filled right whenever dates are added, but the formulas in the option B table will not need changes. I would use option B, personally.

Your original data, with helper rows added, and options A and B:
2024-11-19.xlsx
ABCDEFGHIJKLMNOPQRST
1NameAverageThursdayFridayMondayTuesdayWednesdayThursdayFridayMondayTuesdayWednesdayThursdayFridayMondayTuesdayThursdayFridaySaturdaySunday
205-Sep06-Sep09-Sep10-Sep11-Sep12-Sep13-Sep16-Sep17-Sep18-Sep19-Sep20-Sep23-Sep24-Sep19-Sep20-Sep21-Sep22-Sep
3
4Person13.6466126141661
5
6Person23.0011112666
7
8Person32.8242113125255
9
10Person44.303662365255
11
12Person51.4511111411212
13
14Person61.4511111111611
15
16Person71.9111133331131
17
18Person81.0911111121111
19
20Helper rowsThursdayFridayMondayTuesdayWednesdayThursdayFridayMondayTuesdayWednesdayThursdayFridayMondayTuesdayThursdayFridaySaturdaySunday
211557534252340000000
222010210203010000000
233100131100100000000
244100001100000000000
255000000020220000000
266121011212100000000
27
28A. Without helper rowsB. With helper rows
2914554%All People123456All PeopleMondayTuesdayWednesdayThursdayFriday
3021012%Monday120002211276137
313810%Tuesday751002205113
32434%Wednesday614022301421
33567%Thursday1312222400021
3461214%Friday731104520220
3584100%622224
36
37123456
38Person1410105
39Person2410003
40Person3331130
41Person4022033
42Person5820100
43Person61000001
44Person7605000
45Person81010000
Sheet1
Cell Formulas
RangeFormula
C1:T1C1=TEXT(WEEKDAY(C2),"Dddd")
D2:P2D2=WORKDAY(C2,1)
B4,B18,B16,B14,B12,B10,B8,B6B4=AVERAGE(C4:S4)
C20:T20C20=C1
C21:C26C21=COUNTIF(C$4:C$18,$B21)
D21:T26D21=COUNTIF(D$4:D$18,$A29)
C29:C34C29=COUNTIF($C$4:$M$18,A29)
D29:D34D29=C29/$C$35
C35C35=SUM($C$29:$C$34)
D35D35=SUM($D$29:$D$34)
G30:L34G30=COUNTIFS($4:$4,G$29,$1:$1,$F30)+COUNTIFS($6:$6,G$29,$1:$1,$F30)+COUNTIFS($8:$8,G$29,$1:$1,$F30)+COUNTIFS($10:$10,G$29,$1:$1,$F30)+COUNTIFS($12:$12,G$29,$1:$1,$F30)+COUNTIFS($14:$14,G$29,$1:$1,$F30)+COUNTIFS($16:$16,G$29,$1:$1,$F30)+COUNTIFS($18:$18,G$29,$1:$1,$F30)
O30:S35O30=SUMIFS(21:21,$1:$1,O$29)
C38:H38C38=COUNTIF($C4:$O4,C$37)
C39:H39C39=COUNTIF($C6:$O6,C$37)
C40:H40C40=COUNTIF($C8:$O8,C$37)
C41:H41C41=COUNTIF($C10:$O10,C$37)
C42:H42C42=COUNTIF($C12:$O12,C$37)
C43:H43C43=COUNTIF($C14:$O14,C$37)
C44:H44C44=COUNTIF($C16:$O16,C$37)
C45:H45C45=COUNTIF($C18:$O18,C$37)


Option C (lots of mini tables):
2024-11-19.xlsx
UVWXYZAA
28C. Lots of mini tables
29All Persons123456
30Monday1200011
31Tuesday1200011
32Wednesday1200011
33Thursday1200011
34Friday1200011
35
36
37Person1123456
38Monday200000
39Tuesday010001
40Wednesday000002
41Thursday200001
42Friday000101
43
44Person2123456
45Monday100001
46Tuesday100000
47Wednesday010000
48Thursday100001
49Friday100001
50
51Person3123456
52Monday100010
53Tuesday110000
54Wednesday001010
55Thursday100110
56Friday020000
57
58Person4123456
59Monday200000
60Tuesday110000
61Wednesday200000
62Thursday110100
63Friday200000
64
65Person5123456
66Monday200000
67Tuesday100001
68Wednesday200000
69Thursday300000
70Friday200000
71
72Person6123456
73Monday200000
74Tuesday101000
75Wednesday002000
76Thursday201000
77Friday101000
78
79Person7123456
80Monday200000
81Tuesday200000
82Wednesday200000
83Thursday300000
84Friday110000
85
86Person8123456
87Monday000000
88Tuesday000000
89Wednesday000000
90Thursday000000
91Friday000000
Sheet1
Cell Formulas
RangeFormula
V30:AA34V30=SUMIFS(V$37:V$91,$U37:$U91,$U30)
V38:AA42V38=COUNTIFS($1:$1,$U38,$4:$4,V$37)
V45:AA49V45=COUNTIFS($1:$1,$U45,$6:$6,V$37)
V52:AA56V52=COUNTIFS($1:$1,$U52,$8:$8,V$37)
V59:AA63V59=COUNTIFS($1:$1,$U59,$12:$12,V$37)
V66:AA70V66=COUNTIFS($1:$1,$U66,$14:$14,V$37)
V73:AA77V73=COUNTIFS($1:$1,$U73,$16:$16,V$37)
V80:AA84V80=COUNTIFS($1:$1,$U80,$18:$18,V$37)
V87:AA91V87=COUNTIFS($1:$1,$U87,$28:$28,V$37)
 
Upvote 0

Forum statistics

Threads
1,224,813
Messages
6,181,109
Members
453,021
Latest member
Justyna P

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