Hello,
I was hoping someone would be able to help me out with an excel problem I have.
I have a spreadsheet which contains data in one minute intervals in the following format:
<tbody>
</tbody>etc. for 1400 odd records (24hrs)
What I need to end up with is for each hour, the maximum value in column C with the corresponding value in column B. This data then gets pasted into several other sheets. For example, the above data may result in:
<tbody>
</tbody>etc. for 24 records.
I've put them into an array as follows;
But, I'm not sure what to do from there. Do I have to reDim this into 24 sub arrays to get the data for each hour or can I do it directly from the original array? I think I could work out how to do ReDim this using the row number but also, occasionally, a record will be missed (or sometimes duplicated) so that would displace the records from then on. It would be better to actually look at the times.
I know there not much to go on so far, but I'm hoping there's a simple way to do this and I can't seem to find anything.
Thanks in advance for any help.
I was hoping someone would be able to help me out with an excel problem I have.
I have a spreadsheet which contains data in one minute intervals in the following format:
<tbody> </tbody> |
<tbody>
</tbody>
What I need to end up with is for each hour, the maximum value in column C with the corresponding value in column B. This data then gets pasted into several other sheets. For example, the above data may result in:
A | B | C |
7/16/2015 1:00 | 2.8 | 6.2 |
7/16/2015 2:00 | 4.1 | 9.5 |
<tbody>
</tbody>
I've put them into an array as follows;
Code:
Dim Array_1() As Variant
Dim r, i As Integer
r = WorksheetFunction.CountA(Worksheets(1).Columns(1))
ReDim Array_1(r, 2)
For i = 1 To r
Array_1(i, 0) = Range("A" & i + 2)
Array_1(i, 1) = Range("B" & i + 2)
Array_1(i, 2) = Range("C" & i + 2)
Next
I know there not much to go on so far, but I'm hoping there's a simple way to do this and I can't seem to find anything.
Thanks in advance for any help.