I need to extract a series of values from a worksheet, and the position of the location of the values may vary by worksheet.
So the worksheet looks like this:
...and so on for Q3 and Q4.
So, let's say I start with Google. I want to find the Google revenue for Full Year, Q1, Q2, Q3, and Q4. And since I have to do this hundreds of times, I want to do it programatically.
I'm going to be looping through multiple workbooks, and the Google Q2 revenue data is not always in the exact same cell. Basically, I want a function that returns the applicable values, something like this:
Function Gather_Revenue_By_Site (Site As String, wkbk As Workbook)
And it would be run something like this:
Dim GoogleValues[4] As String
Set GoogleValues[4] = Gather_Revenue_By_Site (Google, CurrentWorkbook)
And it would return an array like this:
{$100, $2, $98, $92, $23}
...reflecting whatever the Google data is in the workbook in question.
I'm not sure whether to approach this by:
...doing a programmatic VLOOKUP?
...programmatically finding the addresses of Q1, Q2, etc. and then using those locations as a boundary for some kind of search, VLOOKUP or otherwise?
...something else?
I'll be looping through hundreds of workbooks to do this. The core problem (to me) is that, while the general organization of the worksheet is always the same, the order of the sites is not always the same, and the start and end of each quarterly section are not always in the same place.
I have a general (though not perfect) idea of how to loop through the files and copy data (also explored somewhat in other threads), but what I'm concerned with here is how to parse a particular worksheet to be sure that I'm getting the appropriate revenue number per website per quarter.
Open to providing more information; just trying to keep it simple so my question will be easier to answer. Thanks.
So the worksheet looks like this:
Code:
FULL-YEAR REVENUE
GOOGLE $100
MR.EXCEL $20
OZGRID $35
Q1
GOOGLE $2
MR.EXCEL $238
OZGRID $23
Q2
GOOGLE $98
MR.EXCEL $93
OZGRID $91
...and so on for Q3 and Q4.
So, let's say I start with Google. I want to find the Google revenue for Full Year, Q1, Q2, Q3, and Q4. And since I have to do this hundreds of times, I want to do it programatically.
I'm going to be looping through multiple workbooks, and the Google Q2 revenue data is not always in the exact same cell. Basically, I want a function that returns the applicable values, something like this:
Function Gather_Revenue_By_Site (Site As String, wkbk As Workbook)
And it would be run something like this:
Dim GoogleValues[4] As String
Set GoogleValues[4] = Gather_Revenue_By_Site (Google, CurrentWorkbook)
And it would return an array like this:
{$100, $2, $98, $92, $23}
...reflecting whatever the Google data is in the workbook in question.
I'm not sure whether to approach this by:
...doing a programmatic VLOOKUP?
...programmatically finding the addresses of Q1, Q2, etc. and then using those locations as a boundary for some kind of search, VLOOKUP or otherwise?
...something else?
I'll be looping through hundreds of workbooks to do this. The core problem (to me) is that, while the general organization of the worksheet is always the same, the order of the sites is not always the same, and the start and end of each quarterly section are not always in the same place.
I have a general (though not perfect) idea of how to loop through the files and copy data (also explored somewhat in other threads), but what I'm concerned with here is how to parse a particular worksheet to be sure that I'm getting the appropriate revenue number per website per quarter.
Open to providing more information; just trying to keep it simple so my question will be easier to answer. Thanks.