Using an excel formula on filtered cells?

I have the following excel spreadsheet:

The elevation is increasing in ascending order. The distance is culmulative. Criteria is a separate formula which can be explained here:

Selecting values in a list based on an interval?

I want to calculate the slope which is the difference in elevation divided by the difference in distance, but only for the values that have a criteria of "1". Here is a picture showing the spreadsheet filtered and cut where I get the expected values of slope:

I want to perform this formula on the unfiltered list and to get the desired result in the third image.

Are there any formula operations in excel that can perform this task? Can it be done in VBA?


You can add 2 helper columns to your table like so:

Col D tracks the last Elevation that met your criteria. Similarly, Col E selects the last Distance that met your criteria. This keep COL F's formula super simple.

Note this is a variation on Alan's comment, but I prefer the legibility and maintainability of the additional columns to the expert level (and lengthy) formula.

Need Your Help

Different results for linalg.norm in numpy

python numpy matrix feature-extraction euclidean-distance

I am trying to create a feature matrix based on certain features and then finding distance b/w the items.