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:
[TABLE="width: 214"]
<tbody>[TR]
[TD][TABLE="width: 371"]
<tbody>[TR]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[/TR]
[TR]
[TD]7/16/2015 0:00[/TD]
[TD]2.4[/TD]
[TD]5.3[/TD]
[/TR]
[TR]
[TD]7/16/2015 0:01[/TD]
[TD]2.2[/TD]
[TD]4.1[/TD]
[/TR]
[TR]
[TD]7/16/2015 0:02[/TD]
[TD]2.8[/TD]
[TD]6.2[/TD]
[/TR]
[TR]
[TD]7/16/2015 0:03[/TD]
[TD]2.4[/TD]
[TD]5.4[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]
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:
[TABLE="width: 371"]
<tbody>[TR]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[/TR]
[TR]
[TD]7/16/2015 1:00[/TD]
[TD]2.8[/TD]
[TD]6.2[/TD]
[/TR]
[TR]
[TD]7/16/2015 2:00[/TD]
[TD]4.1[/TD]
[TD]9.5[/TD]
[/TR]
</tbody>[/TABLE]
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:
[TABLE="width: 214"]
<tbody>[TR]
[TD][TABLE="width: 371"]
<tbody>[TR]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[/TR]
[TR]
[TD]7/16/2015 0:00[/TD]
[TD]2.4[/TD]
[TD]5.3[/TD]
[/TR]
[TR]
[TD]7/16/2015 0:01[/TD]
[TD]2.2[/TD]
[TD]4.1[/TD]
[/TR]
[TR]
[TD]7/16/2015 0:02[/TD]
[TD]2.8[/TD]
[TD]6.2[/TD]
[/TR]
[TR]
[TD]7/16/2015 0:03[/TD]
[TD]2.4[/TD]
[TD]5.4[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]
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:
[TABLE="width: 371"]
<tbody>[TR]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[/TR]
[TR]
[TD]7/16/2015 1:00[/TD]
[TD]2.8[/TD]
[TD]6.2[/TD]
[/TR]
[TR]
[TD]7/16/2015 2:00[/TD]
[TD]4.1[/TD]
[TD]9.5[/TD]
[/TR]
</tbody>[/TABLE]
etc. for 24 records.
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.