powerjak
New Member
- Joined
- Jan 28, 2003
- Messages
- 29
I'm an intermediate Excel user, but "don't know diddly" about creating VBA Macros for recurrent processes. I'd really appreciate some help from someone more advanced than I am to create a Macro to reduce the time it takes to process these files.
I frequently have to pre-process Hourly Sample data to reduce data volume and sync it up against other data at the same time intervals for deeper analysis. The raw data is provided to me in a XLSX file in a format as follows:
Date Time Value1 Value2 Value3 Value4 Value5 Value6 Value![Thumbs down (n) (n)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
9/2/2011 12:00:00 AM 50.21 42 47.38 79.77 84.74 1.16
9/2/2011 1:00:00 AM 49.1 42 47.39 78.76 83.69 0.83
9/2/2011 2:00:00 AM 48.18 42 47.38 78.39 83.52 0.62
9/2/2011 3:00:00 AM 48.29 42 47.38 78.39 83.52 0.62
9/2/2011 4:00:00 AM 47.8 42 47.38 78.39 83.44 0.61
9/2/2011 5:00:00 AM 47.08 42 47.38 78.39 82.3 0.41
9/2/2011 6:00:00 AM 47.39 42 47.38 76.68 81.42 0.12
9/2/2011 7:00:00 AM
9/2/2011 8:00:00 AM 46.35 42 47.38 74.73 79.85 -0.33
9/2/2011 9:00:00 AM 45.68 42 47.4 74.73 79.85 -0.36
9/2/2011 10:00:00 AM 48.79 42 48.1 74.85 80.14 -0.1
9/2/2011 11:00:00 AM 52.17 42 48.34 76.23 81.88 0.48
9/2/2011 12:00:00 PM 55.12 42 48.84 77.62 83.35 0.94
9/2/2011 1:00:00 PM 56.81 42 48.84 78.39 83.76 1.19
9/2/2011 2:00:00 PM 56.17 42 48.84 78.39 84.17 1.24
9/2/2011 3:00:00 PM 57.28 42 48.84 78.39 84.98 1.33
9/2/2011 4:00:00 PM 56.86 42 48.84 78.69 84.98 1.48
9/2/2011 5:00:00 PM 57.36 42 48.84 79.61 84.98 1.48
9/2/2011 6:00:00 PM 56.47 42 48.84 79.61 84.98 1.39
9/2/2011 7:00:00 PM 56.37 42 48.84 79.61 84.98 1.42
9/2/2011 8:00:00 PM 56.64 42 48.84 79.61 84.94 1.33
9/2/2011 9:00:00 PM 53.88 42 48.15 78.39 83.76 0.93
9/2/2011 10:00:00 PM 52.08 42 48.11 78.39 83.76 0.89
9/2/2011 11:00:00 PM 51.48 42 48.11 78.39 83.76 0.9
9/3/2011 12:00:00 AM 51.26 42 48.11 78.39 83.76 0.9
9/3/2011 1:00:00 AM 50.98 42 48.11 77.9 82.61 0.79
9/3/2011 2:00:00 AM 50.21 42 48.11 77.9 82.54 0.73
9/3/2011 3:00:00 AM 49.65 42 48.11 77.9 82.54 0.68
9/3/2011 4:00:00 AM 49.61 42 48.07 77.9 82.54 0.65
9/3/2011 5:00:00 AM 48.48 42 47.38 77.34 82.54 0.48
9/3/2011 6:00:00 AM 48.83 42 47.4 77.17 82.54 0.46
9/3/2011 7:00:00 AM 48.83 42 48.11 76.78 81.54 0.22
9/3/2011 8:00:00 AM 48.02 42 48.11 75.95 81.32 0.06
9/3/2011 9:00:00 AM 48.05 42 48.11 75.95 81.32 -0.06
9/3/2011 10:00:00 AM 49.8 42 48.11 75.95 81.32 0.2
9/3/2011 11:00:00 AM 50.91 42 48.11 75.95 82.05 0.59
9/3/2011 12:00:00 PM 51.83 42 48.11 75.95 82.54 0.59
9/3/2011 1:00:00 PM 53.34 42 48.18 76.74 82.54 0.66
9/3/2011 2:00:00 PM 53.94 42 48.84 77.17 82.54 0.8
9/3/2011 3:00:00 PM 54.11 42 48.84 77.17 82.54 0.87
9/3/2011 4:00:00 PM 54.91 42 48.84 77.17 83.21 0.94
9/3/2011 5:00:00 PM 53.91 42 48.84 77.17 83.76 0.9
9/3/2011 6:00:00 PM 54.52 42 48.84 77.17 83.76 0.92
9/3/2011 7:00:00 PM 53.38 42 48.49 77.17 83.56 0.86
9/3/2011 8:00:00 PM 50.54 42 48.11 77.17 82.54 0.47
9/3/2011 9:00:00 PM 49.9 42 48.11 77.17 81.87 0.26
9/3/2011 10:00:00 PM 48.4 42 48.11 77.17 81.32 0.2
9/3/2011 11:00:00 PM 47.76 42 47.5 77.17 81.32 0.13
Macro/VBA Parsing Process Specification
1. Worksheet to be processed has Header Row containing Column Titles. Must remain intact.
2. Number of Columns are variable. Example has Columns A through H, but could have many more. Must process all Columns until end of data.
3. Number of Rows are variable. Example has 48 Rows (excluding Header/Title Row), but could be many thousands of Rows total. Must process all Rows until end of data.
4. Each Row is an Hourly Data Sample of values taken Daily, On-the-Hour, beginning at 12:00:00 AM to 11:00:00 PM (24 Records/Rows per Day). File may start with any Calendar Date in format m/d/yyyy in Column A.
5. Column B contains the Hourly Time Stamp 12:00:00 AM through 11:00:00 PM for each Date in Column A.
6. Some data value cells may be blank although there are valid Date & Time values in Columns A & B. Such a Row must process correctly as long as the Date & Time values are valid. See Row 10 in "Example_BEFORE"
7. Rows to Extract have the Column B Time Stamps of 3:00:00 AM, 9:00:00 AM, 3:00:00 PM and 9:00:00 PM. (The Rows in "Example_BEFORE" that are highlighted in Yellow.)
8. DO NOT use Row Counting to capture every 6th Row because first Time Stamp may NOT be 12:00:00 AM, and Rows may be missing. Macro MUST process based on the actual Date & Time Values in Columns A & B.
9. Result of Macro Run leaves the original worksheet intact without change, and creates a NEW Worksheet in the Workbook containing each of the extracted Rows with their corresponding data.
Resulting New Worksheet After Macro Processing
Date Time Value1 Value2 Value3 Value4 Value5 Value6 Value![Thumbs down (n) (n)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
9/2/2011 3:00:00 AM 48.29 42 47.38 78.39 83.52 0.62
9/2/2011 9:00:00 AM 45.68 42 47.4 74.73 79.85 -0.36
9/2/2011 3:00:00 PM 57.28 42 48.84 78.39 84.98 1.33
9/2/2011 9:00:00 PM 53.88 42 48.15 78.39 83.76 0.93
9/3/2011 3:00:00 AM 49.65 42 48.11 77.9 82.54 0.68
9/3/2011 9:00:00 AM 48.05 42 48.11 75.95 81.32 -0.06
9/3/2011 3:00:00 PM 54.11 42 48.84 77.17 82.54 0.87
9/3/2011 9:00:00 PM 49.9 42 48.11 77.17 81.87 0.26
Can some lend a helping hand?
Thanks in Advance.
I frequently have to pre-process Hourly Sample data to reduce data volume and sync it up against other data at the same time intervals for deeper analysis. The raw data is provided to me in a XLSX file in a format as follows:
Date Time Value1 Value2 Value3 Value4 Value5 Value6 Value
9/2/2011 12:00:00 AM 50.21 42 47.38 79.77 84.74 1.16
9/2/2011 1:00:00 AM 49.1 42 47.39 78.76 83.69 0.83
9/2/2011 2:00:00 AM 48.18 42 47.38 78.39 83.52 0.62
9/2/2011 3:00:00 AM 48.29 42 47.38 78.39 83.52 0.62
9/2/2011 4:00:00 AM 47.8 42 47.38 78.39 83.44 0.61
9/2/2011 5:00:00 AM 47.08 42 47.38 78.39 82.3 0.41
9/2/2011 6:00:00 AM 47.39 42 47.38 76.68 81.42 0.12
9/2/2011 7:00:00 AM
9/2/2011 8:00:00 AM 46.35 42 47.38 74.73 79.85 -0.33
9/2/2011 9:00:00 AM 45.68 42 47.4 74.73 79.85 -0.36
9/2/2011 10:00:00 AM 48.79 42 48.1 74.85 80.14 -0.1
9/2/2011 11:00:00 AM 52.17 42 48.34 76.23 81.88 0.48
9/2/2011 12:00:00 PM 55.12 42 48.84 77.62 83.35 0.94
9/2/2011 1:00:00 PM 56.81 42 48.84 78.39 83.76 1.19
9/2/2011 2:00:00 PM 56.17 42 48.84 78.39 84.17 1.24
9/2/2011 3:00:00 PM 57.28 42 48.84 78.39 84.98 1.33
9/2/2011 4:00:00 PM 56.86 42 48.84 78.69 84.98 1.48
9/2/2011 5:00:00 PM 57.36 42 48.84 79.61 84.98 1.48
9/2/2011 6:00:00 PM 56.47 42 48.84 79.61 84.98 1.39
9/2/2011 7:00:00 PM 56.37 42 48.84 79.61 84.98 1.42
9/2/2011 8:00:00 PM 56.64 42 48.84 79.61 84.94 1.33
9/2/2011 9:00:00 PM 53.88 42 48.15 78.39 83.76 0.93
9/2/2011 10:00:00 PM 52.08 42 48.11 78.39 83.76 0.89
9/2/2011 11:00:00 PM 51.48 42 48.11 78.39 83.76 0.9
9/3/2011 12:00:00 AM 51.26 42 48.11 78.39 83.76 0.9
9/3/2011 1:00:00 AM 50.98 42 48.11 77.9 82.61 0.79
9/3/2011 2:00:00 AM 50.21 42 48.11 77.9 82.54 0.73
9/3/2011 3:00:00 AM 49.65 42 48.11 77.9 82.54 0.68
9/3/2011 4:00:00 AM 49.61 42 48.07 77.9 82.54 0.65
9/3/2011 5:00:00 AM 48.48 42 47.38 77.34 82.54 0.48
9/3/2011 6:00:00 AM 48.83 42 47.4 77.17 82.54 0.46
9/3/2011 7:00:00 AM 48.83 42 48.11 76.78 81.54 0.22
9/3/2011 8:00:00 AM 48.02 42 48.11 75.95 81.32 0.06
9/3/2011 9:00:00 AM 48.05 42 48.11 75.95 81.32 -0.06
9/3/2011 10:00:00 AM 49.8 42 48.11 75.95 81.32 0.2
9/3/2011 11:00:00 AM 50.91 42 48.11 75.95 82.05 0.59
9/3/2011 12:00:00 PM 51.83 42 48.11 75.95 82.54 0.59
9/3/2011 1:00:00 PM 53.34 42 48.18 76.74 82.54 0.66
9/3/2011 2:00:00 PM 53.94 42 48.84 77.17 82.54 0.8
9/3/2011 3:00:00 PM 54.11 42 48.84 77.17 82.54 0.87
9/3/2011 4:00:00 PM 54.91 42 48.84 77.17 83.21 0.94
9/3/2011 5:00:00 PM 53.91 42 48.84 77.17 83.76 0.9
9/3/2011 6:00:00 PM 54.52 42 48.84 77.17 83.76 0.92
9/3/2011 7:00:00 PM 53.38 42 48.49 77.17 83.56 0.86
9/3/2011 8:00:00 PM 50.54 42 48.11 77.17 82.54 0.47
9/3/2011 9:00:00 PM 49.9 42 48.11 77.17 81.87 0.26
9/3/2011 10:00:00 PM 48.4 42 48.11 77.17 81.32 0.2
9/3/2011 11:00:00 PM 47.76 42 47.5 77.17 81.32 0.13
Macro/VBA Parsing Process Specification
1. Worksheet to be processed has Header Row containing Column Titles. Must remain intact.
2. Number of Columns are variable. Example has Columns A through H, but could have many more. Must process all Columns until end of data.
3. Number of Rows are variable. Example has 48 Rows (excluding Header/Title Row), but could be many thousands of Rows total. Must process all Rows until end of data.
4. Each Row is an Hourly Data Sample of values taken Daily, On-the-Hour, beginning at 12:00:00 AM to 11:00:00 PM (24 Records/Rows per Day). File may start with any Calendar Date in format m/d/yyyy in Column A.
5. Column B contains the Hourly Time Stamp 12:00:00 AM through 11:00:00 PM for each Date in Column A.
6. Some data value cells may be blank although there are valid Date & Time values in Columns A & B. Such a Row must process correctly as long as the Date & Time values are valid. See Row 10 in "Example_BEFORE"
7. Rows to Extract have the Column B Time Stamps of 3:00:00 AM, 9:00:00 AM, 3:00:00 PM and 9:00:00 PM. (The Rows in "Example_BEFORE" that are highlighted in Yellow.)
8. DO NOT use Row Counting to capture every 6th Row because first Time Stamp may NOT be 12:00:00 AM, and Rows may be missing. Macro MUST process based on the actual Date & Time Values in Columns A & B.
9. Result of Macro Run leaves the original worksheet intact without change, and creates a NEW Worksheet in the Workbook containing each of the extracted Rows with their corresponding data.
Resulting New Worksheet After Macro Processing
Date Time Value1 Value2 Value3 Value4 Value5 Value6 Value
9/2/2011 3:00:00 AM 48.29 42 47.38 78.39 83.52 0.62
9/2/2011 9:00:00 AM 45.68 42 47.4 74.73 79.85 -0.36
9/2/2011 3:00:00 PM 57.28 42 48.84 78.39 84.98 1.33
9/2/2011 9:00:00 PM 53.88 42 48.15 78.39 83.76 0.93
9/3/2011 3:00:00 AM 49.65 42 48.11 77.9 82.54 0.68
9/3/2011 9:00:00 AM 48.05 42 48.11 75.95 81.32 -0.06
9/3/2011 3:00:00 PM 54.11 42 48.84 77.17 82.54 0.87
9/3/2011 9:00:00 PM 49.9 42 48.11 77.17 81.87 0.26
Can some lend a helping hand?
Thanks in Advance.