Average the Last 3 Non-Zero Values

Averaging the Last 3 Non-Zero Values

The following formula returns the average of the last 3 non-zero values in A2:A10...

=AVERAGE(IF(ROW(A2:A10)>=LARGE(IF(A2:A10,ROW(A2:A10)),3),IF(A2:A10,A2:A10)))

Note that the formula needs to be confirmed with CONTROL+SHIFT+ENTER. If done correctly, Excel will automatically place curly braces {...} around the formula.

Based on the sample data, the formula returns 80.

Sample Workbook: Download