<colgroup><col><col span="3"><col><col><col></colgroup><tbody></tbody>
What I have is a sheet of dates and job codes and a sheet with job codes and their duration.
I'd like to sum the duration of work in each month.
Sheet1 | Sheet2 | |||||
A | B | A | B | |||
1 | Code | Date | 1 | Code | Duration | |
2 | 1 | 1/18/2018 | 2 | 1 | 5 | |
3 | 2 | 4/23/2018 | 3 | 2 | 10 | |
4 | 3 | 1/22/2018 | 4 | 3 | 15 | |
5 | 4 | 4/18/2017 | 5 | 4 | 20 | |
6 | 5 | 1/22/2018 | 6 | 5 | 25 | |
7 | 6 | 4/18/2017 | 7 | 6 | 30 | |
8 | 1 | 4/9/2018 | ||||
9 | 2 | 2/16/2018 | ||||
10 | 3 | 4/25/2017 |
<colgroup><col><col span="3"><col><col><col></colgroup><tbody>
</tbody>
I have this working right now with the following code as long as the to arrays are the same size:
SUMPRODUCT(SUMIF('Sheet1'!A2:A7,'Sheet2'!A2:A7,'Sheet2'!B2:B7),(MONTH('Sheet1'!B2:B7)=4)*(YEAR('Sheet1'!B2:B7)=2017))
But as you can see Sheet1 is longer and will be changing in size.
Any ideas on making this work with different array sizes or an alternate approach?