I have the following set of test data:
<tbody>
</tbody>
Cell D2 =SUM(COUNTIFS($F$2:$F$37,A2,$G$2:$G$37,B2,$H$2:$H$37,C2,$I$2:$I$37,{1,2}))
Lets just assume that I have a formula =SUM(Countifs(I2:I37,{1,2})), how would I write that to VBA?
I can probably handle the rest. I just have no clue how to use arrays this way in VBA or how to begin looking to learn.
A | B | C | D | E | F | G | H | I | |
1 | ID | svc from | svc to | svc 1 & 2count | ID | svc from | svc to | svc code | |
2 | 1 | 1/1/2010 | 1/31/2010 | 3 | 1 | 1/1/2010 | 1/31/2010 | 1 | |
3 | 1 | 2/1/2010 | 2/28/2010 | 3 | 1 | 1/1/2010 | 1/31/2010 | 3 | |
4 | 2 | 2/1/2010 | 2/28/2010 | 3 | 1 | 1/1/2010 | 1/31/2010 | 2 | |
5 | 2 | 3/1/2010 | 3/31/2010 | 2 | 1 | 1/1/2010 | 1/31/2010 | 1 | |
6 | 2 | 4/1/2010 | 4/30/2010 | 1 | 1 | 2/1/2010 | 2/28/2010 | 5 | |
7 | 3 | 4/1/2010 | 4/30/2010 | 0 | 1 | 2/1/2010 | 2/28/2010 | 1 | |
8 | 3 | 5/1/2010 | 5/31/2010 | 3 | 1 | 2/1/2010 | 2/28/2010 | 2 | |
9 | 3 | 6/1/2010 | 6/30/2010 | 1 | 1 | 2/1/2010 | 2/28/2010 | 1 | |
10 | 4 | 7/1/2010 | 7/31/2010 | 1 | 1 | 2/1/2010 | 2/28/2010 | 4 | |
11 | 5 | 7/1/2010 | 7/31/2010 | 2 | 2 | 2/1/2010 | 2/28/2010 | 1 | |
12 | 2 | 2/1/2010 | 2/28/2010 | 5 | |||||
13 | 2 | 2/1/2010 | 2/28/2010 | 1 | |||||
14 | 2 | 2/1/2010 | 2/28/2010 | 2 | |||||
15 | 2 | 2/1/2010 | 2/28/2010 | 4 | |||||
16 | 2 | 2/1/2010 | 2/28/2010 | 4 | |||||
17 | 2 | 3/1/2010 | 3/31/2010 | 2 | |||||
18 | 2 | 3/1/2010 | 3/31/2010 | 3 | |||||
19 | 2 | 3/1/2010 | 3/31/2010 | 1 | |||||
20 | 2 | 3/1/2010 | 3/31/2010 | 4 | |||||
21 | 2 | 4/1/2010 | 4/30/2010 | 2 | |||||
22 | 3 | 4/1/2010 | 4/30/2010 | 3 | |||||
23 | 3 | 4/1/2010 | 4/30/2010 | 4 | |||||
24 | 3 | 4/1/2010 | 4/30/2010 | 5 | |||||
25 | 3 | 5/1/2010 | 5/31/2010 | 2 | |||||
26 | 3 | 5/1/2010 | 5/31/2010 | 2 | |||||
27 | 3 | 5/1/2010 | 5/31/2010 | 2 | |||||
28 | 3 | 6/1/2010 | 6/30/2010 | 2 | |||||
29 | 3 | 6/1/2010 | 6/30/2010 | 4 | |||||
30 | 4 | 7/1/2010 | 7/31/2010 | 1 | |||||
31 | 4 | 7/1/2010 | 7/31/2010 | 5 | |||||
32 | 4 | 7/1/2010 | 7/31/2010 | 4 | |||||
33 | 5 | 7/1/2010 | 7/31/2010 | 2 | |||||
34 | 5 | 7/1/2010 | 7/31/2010 | 4 | |||||
35 | 5 | 7/1/2010 | 7/31/2010 | 4 | |||||
36 | 5 | 7/1/2010 | 7/31/2010 | 4 | |||||
37 | 5 | 7/1/2010 | 7/31/2010 | 1 |
<tbody>
</tbody>
Cell D2 =SUM(COUNTIFS($F$2:$F$37,A2,$G$2:$G$37,B2,$H$2:$H$37,C2,$I$2:$I$37,{1,2}))
Lets just assume that I have a formula =SUM(Countifs(I2:I37,{1,2})), how would I write that to VBA?
I can probably handle the rest. I just have no clue how to use arrays this way in VBA or how to begin looking to learn.