Hello,
I have a workbook I'm using as a tracker of how many tasks were done in each day of the year. Each week has its own worksheet (and is named by the week's number - e.g. "35" if the dates covered are between the 21st and 27th of August).
(Tracker sheet)
[TABLE="class: grid, width: 35"]
<tbody>[TR]
[TD][/TD]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Tasks/Date[/TD]
[TD="align: center"]21/08/2017[/TD]
[TD="align: center"]22/08/2017[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Task_1[/TD]
[TD]=SUMPRODUCT(('35'!$C$1:$E$4=$A2)*('35'!$A$1:$A$4=B$1))[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Task_2[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
(week "35" sheet)
[TABLE="class: grid, width: 50, align: left"]
<tbody>[TR]
[TD="align: center"][/TD]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[TD="align: center"]D[/TD]
[TD="align: center"]E[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]21/08/2017[/TD]
[TD]08:00[/TD]
[TD][/TD]
[TD]Task_1[/TD]
[TD]Task_2[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]21/08/2017[/TD]
[TD]09:00[/TD]
[TD]Task_2[/TD]
[TD]Task_1[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]22/08/2017[/TD]
[TD]08:00[/TD]
[TD]Task_1[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]22/08/2017[/TD]
[TD]09:00[/TD]
[TD]Task_2[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
So what I need to do is track how many times in each day each task appears. The SUMPRODUCT formula I've listed in B2 in the Tracker sheet works just fine, however, it is very slow.
I've managed to make it work with VBA by using the Cell.Value2 = Evaluate, but it still takes like 5-6 seconds to do it, and from what I've read, doing the calculations in an array and them pasting the results to the table should take way less than that.
The exact code for the evaluate is as follows:
One thing, the format needs to stay this way, and I cannot use PivotTables...
I'd really appreciate if anyone could help me with a solution to reduce the calculation times on this.
Thanks!
I have a workbook I'm using as a tracker of how many tasks were done in each day of the year. Each week has its own worksheet (and is named by the week's number - e.g. "35" if the dates covered are between the 21st and 27th of August).
(Tracker sheet)
[TABLE="class: grid, width: 35"]
<tbody>[TR]
[TD][/TD]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Tasks/Date[/TD]
[TD="align: center"]21/08/2017[/TD]
[TD="align: center"]22/08/2017[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Task_1[/TD]
[TD]=SUMPRODUCT(('35'!$C$1:$E$4=$A2)*('35'!$A$1:$A$4=B$1))[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Task_2[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
(week "35" sheet)
[TABLE="class: grid, width: 50, align: left"]
<tbody>[TR]
[TD="align: center"][/TD]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[TD="align: center"]D[/TD]
[TD="align: center"]E[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]21/08/2017[/TD]
[TD]08:00[/TD]
[TD][/TD]
[TD]Task_1[/TD]
[TD]Task_2[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]21/08/2017[/TD]
[TD]09:00[/TD]
[TD]Task_2[/TD]
[TD]Task_1[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]22/08/2017[/TD]
[TD]08:00[/TD]
[TD]Task_1[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]22/08/2017[/TD]
[TD]09:00[/TD]
[TD]Task_2[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
So what I need to do is track how many times in each day each task appears. The SUMPRODUCT formula I've listed in B2 in the Tracker sheet works just fine, however, it is very slow.
I've managed to make it work with VBA by using the Cell.Value2 = Evaluate, but it still takes like 5-6 seconds to do it, and from what I've read, doing the calculations in an array and them pasting the results to the table should take way less than that.
The exact code for the evaluate is as follows:
Code:
Set rng = Sheets("Tracker").Range("D6:EM" & Range("C999").End(xlUp).Row)
For Each cell In rng
If Not Cells(cell.Row, 3).Value Like "*Planned*" And Not Cells(cell.Row, 3).Value Like "*all_*" And (Cells(cell.Row, 3).Value Like "X1_*" Or Cells(cell.Row, 3).Value Like "PM_*") Then
cell.Value2 = Evaluate("IFERROR(SUMPRODUCT((" & Cells(1, cell.Column).Value & "!$F$6:$BM$102=" & Cells(cell.Row, 3).Address & ")*(" & Cells(1, cell.Column).Value & "!$D$6:$D$102=" & Cells(4, cell.Column).Address & "))/8,0)")
End If
Next
One thing, the format needs to stay this way, and I cannot use PivotTables...
I'd really appreciate if anyone could help me with a solution to reduce the calculation times on this.
Thanks!