Heat Map

JamieP89

Board Regular
Joined
Mar 8, 2022
Messages
64
Office Version
  1. 365
Platform
  1. Windows
Hi there,

I'm having a slightly difficult time figuring out the best way to approach my Heat Map

The ask:

I am looking to use a set of data (which I will continue to add to each day) to populate the score being provided in column b. What I'm having a hard time processing is the best way to get the score for say two Mondays worth of to populate in "H18" (thinking it would be an average of the data in column b) and so on - This I am hoping will then provide incremental data over say a period of a month about what the average of each day and time looks like

Apologies the same is small as its dummy data at the moment.

I'll then use conditional formatting to show the heatmap.

I tried using a helper column initially to call turn column A into text and Monday to then do a =IF(H18=A1,B2) type calculation but realised while it will pull through the data it wasn't efficient and very manual. I'm guessing a lookup or vlookup would be better, but again just cant think how the lookup and average of x days will work!

Sorry I hope this makes sense....

StackedColumn (4).csv
ABCDEFGHIJKLMN
219/12/2022 00:0099.9
319/12/2022 01:0099.9
419/12/2022 02:0099.9
519/12/2022 03:0099.8
619/12/2022 04:0099.9
719/12/2022 05:0099.9
819/12/2022 06:0099.9
919/12/2022 07:0099.9
1019/12/2022 08:0099.9
1119/12/2022 09:0099.9
1219/12/2022 10:0099.9
1319/12/2022 11:0099.8
1419/12/2022 12:0099.8
1519/12/2022 13:0099.8
1619/12/2022 14:0099.8
1719/12/2022 15:0099.8
1819/12/2022 16:0099.8MondayTuesdayWednesdayThursdayFridaySaturdaySunday
1919/12/2022 17:0099.700:00
2019/12/2022 18:0099.301:00
2119/12/2022 19:0099.802:00
2219/12/2022 20:0099.803:00
2319/12/2022 21:0099.804:00
2419/12/2022 22:0099.805:00
2519/12/2022 23:0099.906:00
2620/12/2022 00:0099.807:00
2720/12/2022 01:0099.908:00
2820/12/2022 02:0099.909:00
2920/12/2022 03:0099.910:00
3020/12/2022 04:0099.911:00
3120/12/2022 05:0099.912:00
3220/12/2022 06:0099.913:00
3320/12/2022 07:0099.914:00
3420/12/2022 08:0099.915:00
3520/12/2022 09:0099.816:00
3620/12/2022 10:0099.917:00
3720/12/2022 11:0099.818:00
3820/12/2022 12:0099.819:00
3920/12/2022 13:0099.820:00
4020/12/2022 14:0099.821:00
4120/12/2022 15:0099.822:00
4220/12/2022 16:0099.823:00
4320/12/2022 17:0099.8
4420/12/2022 18:0099.9
4520/12/2022 19:0099.8
4620/12/2022 20:0099.8
4720/12/2022 21:0099.8
4820/12/2022 22:0099.9
4920/12/2022 23:0099.8
5021/12/2022 00:0099.8
5121/12/2022 01:0099.9
5221/12/2022 02:0099.9
5321/12/2022 03:0099.9
5421/12/2022 04:0099.9
5521/12/2022 05:0099.9
5621/12/2022 06:0099.9
5721/12/2022 07:0099.9
5821/12/2022 08:0099.9
5921/12/2022 09:0099.9
6021/12/2022 10:0099.9
6121/12/2022 11:0099.9
6221/12/2022 12:0099.8
6321/12/2022 13:0099.8
6421/12/2022 14:0099.8
6521/12/2022 15:0099.8
6621/12/2022 16:0099.8
6721/12/2022 17:0099.8
6821/12/2022 18:0099.8
6921/12/2022 19:0099.8
7021/12/2022 20:0099.8
7121/12/2022 21:0099.8
7221/12/2022 22:0099.8
7321/12/2022 23:0099.8
7422/12/2022 00:0099.9
7522/12/2022 01:0099.9
7622/12/2022 02:0099.9
7722/12/2022 03:0099.8
7822/12/2022 04:0099.9
7922/12/2022 05:0099.9
8022/12/2022 06:0099.9
8122/12/2022 07:0099.9
8222/12/2022 08:0099.9
8322/12/2022 09:0099.9
8422/12/2022 10:0099.9
8522/12/2022 11:0099.0
8622/12/2022 12:0099.4
8722/12/2022 13:0099.7
8822/12/2022 14:0099.4
8922/12/2022 15:0099.2
9022/12/2022 16:0099.5
9122/12/2022 17:0099.1
9222/12/2022 18:0099.3
9322/12/2022 19:0099.2
9422/12/2022 20:0099.2
9522/12/2022 21:0099.7
9622/12/2022 22:0099.9
9722/12/2022 23:0099.4
9823/12/2022 00:0099.8
9923/12/2022 01:0099.3
10023/12/2022 02:0099.5
10123/12/2022 03:0099.6
10223/12/2022 04:0099.1
10323/12/2022 05:0099.3
10423/12/2022 06:0099.4
10523/12/2022 07:0099.3
10623/12/2022 08:0099.4
10723/12/2022 09:0099.9
10823/12/2022 10:0099.5
10923/12/2022 11:0099.9
11023/12/2022 12:00100.0
11123/12/2022 13:0099.7
11223/12/2022 14:0099.2
11323/12/2022 15:0099.6
11423/12/2022 16:00100.0
11523/12/2022 17:0099.3
11623/12/2022 18:0099.7
11723/12/2022 19:0099.8
11823/12/2022 20:0099.8
11923/12/2022 21:0099.2
12023/12/2022 22:0099.7
12123/12/2022 23:0099.2
12224/12/2022 00:0099.7
12324/12/2022 01:0099.5
12424/12/2022 02:0099.0
12524/12/2022 03:0099.8
12624/12/2022 04:0099.9
12724/12/2022 05:0099.9
12824/12/2022 06:0099.2
12924/12/2022 07:0099.4
13024/12/2022 08:0099.9
13124/12/2022 09:0099.6
13224/12/2022 10:0099.9
13324/12/2022 11:0099.1
13424/12/2022 12:0099.0
13524/12/2022 13:0099.1
13624/12/2022 14:0099.2
13724/12/2022 15:0099.3
13824/12/2022 16:0099.2
13924/12/2022 17:0099.2
14024/12/2022 18:0099.4
14124/12/2022 19:0099.1
14224/12/2022 20:0099.2
14324/12/2022 21:0099.3
14424/12/2022 22:0099.6
14524/12/2022 23:0099.9
14625/12/2022 00:0099.9
14725/12/2022 01:0099.0
14825/12/2022 02:0099.1
14925/12/2022 03:0099.1
15025/12/2022 04:0099.0
15125/12/2022 05:0099.6
15225/12/2022 06:0099.8
15325/12/2022 07:0099.5
15425/12/2022 08:0099.0
15525/12/2022 09:00100.0
15625/12/2022 10:0099.3
15725/12/2022 11:0099.2
15825/12/2022 12:0099.4
15925/12/2022 13:0099.7
16025/12/2022 14:0099.1
16125/12/2022 15:0099.7
16225/12/2022 16:00100.0
16325/12/2022 17:0099.2
16425/12/2022 18:0099.8
16525/12/2022 19:0099.6
16625/12/2022 20:0099.2
16725/12/2022 21:0099.5
16825/12/2022 22:0099.7
16925/12/2022 23:0099.9
StackedColumn (4)
Cell Formulas
RangeFormula
B85:B169B85=RAND()*1+99
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
H19:
Excel Formula:
=AVERAGEIFS(B:B,TEXT(A:A,"dddd"),H$18,TEXT(A:A,"hh:mm"),$G19)
 
Upvote 0
I could not get the formula in response #2 to work. It gave this error:
1671710478600.png

In trying to work this out and in the past the "S" functions don't like getting an array of something to evaluate, and not have a criteria RANGE that matches in size (rows). The TEXT(A:A,"dddd") is scaler and cannot return an array. That's in 365 anyway. Maybe it works in 2019?
That said, I would recommend using an Excel Table for the data, especially since you said "which I will continue to add to each day". While a full column reference would compensate for that, using a table makes it easier to see what's happening.
ALSO, if you are using 365 and the formula above isn't working, I'd recommend adding helper columns which make the needed evaluations so that AVERAGEIFS can do it's job.
This is the table I recommend:
Book1
ABCD
1Date / TimeValueWeekdayHour
212/19/2022 00:0099.6200:00
312/19/2022 01:0099.6201:00
412/19/2022 02:0099.2202:00
Sheet3
Cell Formulas
RangeFormula
B2:B4B2=ROUND(RAND()*1+99,1)
C2:C4C2=WEEKDAY([@[Date / Time]])
D2:D4D2=ROUND(TIME(HOUR([@[Date / Time]]),0,0),5)

I rounded the value in column B just because it was annoying me! The Time value is rounded because there are known anomalies which can come into play when TIME is involved, and although I don't think that would matter here, it means knowing what the value is.
And here's the heat map:
Book1
GHIJKLMN
18MondayTuesdayWednesdayThursdayFridaySaturdaySunday
190:0099.699.399.399.199.999.699.0
201:0099.099.2100.099.999.199.299.8
212:0099.599.399.799.599.299.799.7
223:0099.499.899.1100.099.499.899.3
234:0099.399.999.5100.099.899.499.7
245:0099.399.599.799.799.599.699.1
256:0099.799.699.799.3100.099.799.4
267:0099.899.499.699.199.199.499.5
278:0099.3100.099.799.299.399.499.2
289:0099.2100.099.899.399.899.899.8
2910:0099.899.499.799.899.399.199.1
3011:0099.199.499.399.499.499.799.1
3112:0099.699.899.099.899.999.299.1
3213:0099.999.599.699.199.399.099.8
3314:0099.999.199.199.599.599.899.6
3415:0099.899.399.799.699.499.8100.0
3516:0099.199.199.699.999.899.499.7
3617:0099.8100.099.899.999.299.299.9
3718:0099.499.899.199.399.399.399.9
3819:0099.799.399.699.799.699.5100.0
3920:0099.499.299.499.299.199.399.0
4021:0099.799.699.599.799.999.399.8
4122:0099.099.699.599.399.799.899.8
4223:0099.399.399.599.299.299.399.1
Sheet3
Cell Formulas
RangeFormula
G19:G42G19=ROUND(TIME(SEQUENCE(24,,0),0,0),5)
H19:N42H19=AVERAGEIFS(Times[Value],Times[Hour],G19#,Times[Weekday],H18:N18)
Dynamic array formulas.
 
Upvote 0
I could not get the formula in response #2 to work. It gave this error:
View attachment 81412
In trying to work this out and in the past the "S" functions don't like getting an array of something to evaluate, and not have a criteria RANGE that matches in size (rows). The TEXT(A:A,"dddd") is scaler and cannot return an array. That's in 365 anyway. Maybe it works in 2019?
That said, I would recommend using an Excel Table for the data, especially since you said "which I will continue to add to each day". While a full column reference would compensate for that, using a table makes it easier to see what's happening.
ALSO, if you are using 365 and the formula above isn't working, I'd recommend adding helper columns which make the needed evaluations so that AVERAGEIFS can do it's job.
This is the table I recommend:
Book1
ABCD
1Date / TimeValueWeekdayHour
212/19/2022 00:0099.6200:00
312/19/2022 01:0099.6201:00
412/19/2022 02:0099.2202:00
Sheet3
Cell Formulas
RangeFormula
B2:B4B2=ROUND(RAND()*1+99,1)
C2:C4C2=WEEKDAY([@[Date / Time]])
D2:D4D2=ROUND(TIME(HOUR([@[Date / Time]]),0,0),5)

I rounded the value in column B just because it was annoying me! The Time value is rounded because there are known anomalies which can come into play when TIME is involved, and although I don't think that would matter here, it means knowing what the value is.
And here's the heat map:
Book1
GHIJKLMN
18MondayTuesdayWednesdayThursdayFridaySaturdaySunday
190:0099.699.399.399.199.999.699.0
201:0099.099.2100.099.999.199.299.8
212:0099.599.399.799.599.299.799.7
223:0099.499.899.1100.099.499.899.3
234:0099.399.999.5100.099.899.499.7
245:0099.399.599.799.799.599.699.1
256:0099.799.699.799.3100.099.799.4
267:0099.899.499.699.199.199.499.5
278:0099.3100.099.799.299.399.499.2
289:0099.2100.099.899.399.899.899.8
2910:0099.899.499.799.899.399.199.1
3011:0099.199.499.399.499.499.799.1
3112:0099.699.899.099.899.999.299.1
3213:0099.999.599.699.199.399.099.8
3314:0099.999.199.199.599.599.899.6
3415:0099.899.399.799.699.499.8100.0
3516:0099.199.199.699.999.899.499.7
3617:0099.8100.099.899.999.299.299.9
3718:0099.499.899.199.399.399.399.9
3819:0099.799.399.699.799.699.5100.0
3920:0099.499.299.499.299.199.399.0
4021:0099.799.699.599.799.999.399.8
4122:0099.099.699.599.399.799.899.8
4223:0099.399.399.599.299.299.399.1
Sheet3
Cell Formulas
RangeFormula
G19:G42G19=ROUND(TIME(SEQUENCE(24,,0),0,0),5)
H19:N42H19=AVERAGEIFS(Times[Value],Times[Hour],G19#,Times[Weekday],H18:N18)
Dynamic array formulas.
I hadn't tested the formula and you are right.
Luckly, I discovered that O365 has ARRAYTOTEXT function :) H19:
Excel Formula:
=AVERAGEIFS(B:B,ARRAYTOTEXT(A:A,"dddd"),H$17,ARRAYTOTEXT(A:A,"hh:mm"),$G18)
I have no O365 to test but hopefully it will work.
 
Last edited by a moderator:
Upvote 0
Another option
Excel Formula:
=AVERAGE(FILTER($B$2:$B$2000,(TEXT($A$2:$A$2000,"dddd")=H$18)*(TEXT($A$2:$A$2000,"hh:mm")=TEXT($G19,"hh:mm"))))
 
Upvote 0
Solution
Another option
Excel Formula:
=AVERAGE(FILTER($B$2:$B$2000,(TEXT($A$2:$A$2000,"dddd")=H$18)*(TEXT($A$2:$A$2000,"hh:mm")=TEXT($G19,"hh:mm"))))

Thanks for the replies on this one all - I decided to go with Fluff's recommendation purely because I was able to quickly understand the logic
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0
Glad we could help & thanks for the feedback.
No probs :-) - I should have added I was looking for a count of how many days under each day of the heat map as well as cant seem to get anything to work without spill...
 
Upvote 0
What do you mean by a count of days?
 
Upvote 0
I think he means something like:
Excel Formula:
=COUNT(FILTER($B$2:$B$2000,(TEXT($A$2:$A$2000,"dddd")=H$18)))
 
Upvote 0

Forum statistics

Threads
1,223,904
Messages
6,175,295
Members
452,633
Latest member
DougMo

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