I have a large Excel table (591 cols, 2645 rows) with a basic format that looks something like this:
| Time | Data 1 | Data 2 | Data 3 | Data 4 | Data 5 | Data 6 | Data 7 |
|======+========+========+========+========+========+========+========|
| 0.01 | 0.35 | | | | | 0.1351 | 0.2398 |
| 0.02 | | 0.42 | | | | 0.4314 | 0.4342 |
| 0.03 | | | 0.99 | | | 0.3414 | 0.4321 |
| 0.04 | | | | 0.12 | | 0.4351 | 0.4256 |
| 0.05 | | | | | 0.66 | 0.7894 | 0.9874 |
This is basically a recording of a data stream where some fields are sampled only once every time step, while others are sampled on every individual time step. An entire “record”, then, is recorded once the loop is finished (ie, “Data 1” is written again).
The final data record, for the purposes of data processing and analysis, looks something like this:
| Time | Data 1 | Data 2 | Data 3 | Data 4 | Data 5 | Data 6 | Data 7 |
|======+========+========+========+========+========+========+========|
| 0.05 | 0.35 | 0.42 | 0.99 | 0.12 | 0.66 | 0.7894 | 0.9874 |
Notice that the timestamp is equal to a timestamp found in the table, that the recurring data fields are equal to the data values at that time, and that the periodic data fields are equal to the last reported value for each of those fields.
The record for a single loop then would basically consist of the final value recorded for any field within the given timeframe. I can do this easily for a single step of this, but I have 2600+ row of data to process per data set and half a dozen data sets to process.
Is there a clean/simple/pragmatic way to do this across the entire data file? I could brute force this any number of ways, but I’m hoping to not have to reinvent the wheel. If I could write the output to a new worksheet, that’d be great.
Here’s the solution I wound up using …
First, I created a second sheet (Sheet 2), copied the header row, and set each record in the first row equal to the first record in the first row on the first sheet (Sheet 1). If the first row in Sheet 1 had an empty value, I replaced it with a zero. For example:
Then I used a formula to conditionally copy the value from Sheet 1 to Sheet 2 or to use the value above the current cell in Sheet 2. For example, in B3 (second record, first field):
I then copied this to every cell in Sheet 2 that had a source value available in Sheet 1. The result looked like this:
From this, I was able to generate relevant plots to analyze the data effectively.