I have an issue with summing up specific entries of an array in VBA. I give you an example of how my matrix looks like (let's call the matrix "startMatrix")
Date ticker value
2005.01 200 1000
2005.01 300 2222
2005.01 400 2000
2005.02 200 1100
2005.02 300 3000
2005.02 400 5555
In VBA the matrix is then read in like this:
startMatrix(1,1) = 2005.01
startMatrix(1,2) = 200
startMatrix(1,3) = 1000
startMatrix(2,1) = 2005.01
startMatrix(2,2) = 300
....
startMatrix(6,3) = 5555
So I would like to sum up the value for each date if the ticker is either 200 or 300 and save this new array (let's call it finalMatrix). The finalMatrix should look like this then:
Date Value
2005.01 3222
2005.02 4100
The finalMatrix should look like this in VBA at the end:
finalMatrix(1,1) = 2005.01
finalMatrix(1,2) = 3222
finalMatrix(2,1) = 2005.01
finalMatrix(2,2) = 4100
I am not very used to these kind of operations so I would really, really appreciate your help. Thank you in advance and have a nice day Elio
Aucun commentaire:
Enregistrer un commentaire