Hi. I have a set of Sp02 data from a 3-day time period that I am using to calculate hypoxic debt. The data is stored in a single array and I am dividing up the array into specific time chunks of different lengths and performing calculations on each chunk of data. In certain sections of each chunk, there are larger sections of erroneous values that I want to fill in with previous non-erroneous values so I can have calculations over the entire duration of the data. I want to replace these sections of bad data with the last previous value before the erroneous data starts, which will change depending on where the section of bad data is located in the array. If there are multiple sections of erroneous values spread out throughout the array of data, how can I extract the last value before the bad data starts and replace the bad data with that single value? **The bad data are values that are equal to 500 or go below 60.
Example: The bad section of data runs from 1 to 500. I have sections of bad data from 10 to 30, 150 to 175, 220 to 240 and 380 to 410. I want to take the values from cell 9, 149, 219, and 379 and put those values in for the bad section i.e. the value in cell 9 would fill in 10 to 30, the value in cell 149 would fill in 150 to 175, and so on.... How would I go about this?