I have data that I need to create some sort of loop for. Basically, I'm searching for a column that has the info I need using a string search, then summing based on various criteria. My problem is that the data is separated by months (using a numberical designation; i.e; Jan=01, Feb=02, etc) and I need a way to add up all the info to date. The formula I am using is below:
=SUMPRODUCT(SUMIFS(INDEX('Program Data'!A:GA,0,MATCH("*"&AC7&" "&AC10&" -"&A8&" "&B15&"*",
'Program Data'!1:1,0)),'Program Data'!$M:$M,$A2,'Program Data'!$E:$E,B2:B6))
Where A8 is the cell that contains the selected month of interest. So lets say A8=08 (August). I want to execute this formula for all previous values of A8 and add them together, adding upwards UNTIL A8 equals the current selection. (or while A8<09, however this can be accomplished)
So assuming A8=08, I want it to start at A8=01, run this code and find the value. Then run A8=02, find that value, then add it to the first value, continuing this until we get to A8=08 and then reporting the final value. Since the single-digit months are written in two-digits (ie; 01, 02, 03, etc) and searched using the leading 0, I think its fairly important the loop account for it up until we get two-digit months (10, 11, 12)....
Something along the lines of (and this is NOT code, just a general thought-process):
Sub Loop1()
Dim x as integer
x=01
Do until x = Cell A8
(insert the formula above, but with "&A8&" = x)
x + 1 = x
End Sub
but even this thought-process doesn't seem to add the resulting formula values together, so I need help with that. I don't know how to perform do loops in excel, so any help you care to offer would be sincerely appreciated. I'm afraid I don't really know where to start, or the logical order each statement. Thanks for looking!
EDIT
Please excuse my poor description, hopefully this clarifies:
The code is a part of a table. Cell A8 is a drop-down selection where you choose the numberical month you want to examine (01, 02 --> 12). The formula then looks for a string using a set of reference cells, lets say "Rev Bud 08 -2013"(where 08 comes from your selection), then looks for a column with that title then performs the sumifs. But I want a year-to-date, so i want it to exceute the formula once for each x, starting at x=1, and up to and including whatever value is selected in cell A8, then add the results from all of the executions together and display that value in a cell of my choosing, let's say cell C50. So I want it to do the sumifs starting on the column with the title "Rev Bud 01 -2013" then "Rev Bud 02 -2013" .... all the way until "Rev Bud [my selection] -2013" and add all of those together.