I'm trying to develop a formula that will allow for a graph of the cumulative slope elevation gain along a route to be created. Currently I am using the Max value of the elevation along the route starting from the beginning of the route. This works until I get to the first decline and then it does not include the slope elevation gain for the entire section of positive slope. I am hoping that the graph would start gaining elevation again at a distance of 1535m and again at each point of positive slope (distance values 4578, 6091). Does anyone have any idea on how to solve this in excel without having to manually create cumulative slope points?