I do have questions about your implementation. Why are you doing the SUMPRODUCT twice? Could you not go =IF(ABS(SUMPRODUCT(..))>1000, ... , ...)? (That might half the time -- not sure how MS implemented things when you use the same formula twice)
Second, for column K, you're finding the number of rows, but for columns C,D,G you're saying the limit is 65,000. (Seems to me there is the potential for missed data there)
My suggestion:
Basically, it's not to use SUMPRODUCT. You're repeating multiple calculations, so you can do it smarter than SUMPRODUCT can because it doesn't know this.
1) Insert a column somewhere. (Probably on the far end of your data)
2) Number it from 1 to the number of rows you want to look at. The purpose of this is to return to the original ordering, because part of my suggestion involves sorting.
3) Sort the data by Column C, D, G. What does this do? It makes it so all rows that pertain to the same values in C, D, G are contiguous. The benefit? It means we don't need to look at all 65,000 rows to find the data.
4) Using code similar to the following, go through each row to determine whether it is Out of Tolerance.
5) Re-sort your data by the column that was inserted with the line numbers.
6) Delete the extra column.
If you don't care about the order of the data, skip steps 1, 2, 5, and 6.
This won't be ultra-fast... but it will be significantly faster than what you had. If you want it to be faster, you'll have to pull the 4 columns into memory initially. The do your calculations and output the results to another array. Then dump that array back into the worksheet. However, this method above is probably simpler to code. If you find the speed to be still too slow, say so.
Scott
Bookmarks