Any clever ideas for excluding aberrant values produced by an ISR?

Robin2:
What is a clever way to detect and ignore the 3876?

The correct way is with statistics (calculate the likelihood the current value is a member of the set).

A simple way is a (small) window average ignoring the high and low values.

Are you averaging or are the individual values important?

Are those values "real"? Or a simplified example for illustration purposes? (This question is very important. You may have an overrun problem.)

But, it would be comforting to see the rest of the code that touches those two variables.