# calculate the slope of a range of numbers, if the numbers are more or less descending

1. ## calculate the slope of a range of numbers, if the numbers are more or less descending

I have a data set that's from measuring gas concentration. basically, gas is injected into a chamber quickly (so concentration goes up over time), and then dissipates slowly (so, concentration goes down over time). There's a bit of noise in the concentration measurements, so sometimes the concentration measurement goes up a tiny bit during the "dissipation" phase of things.

Ultimately, I need to calculate the slope of the dissipation phase. This cycle happens a whole bunch of times each day -- injection, then dissipation.

Is there a way I can have excel automatically detect where the values are generally decreasing (allowing for the odd gas measurement that goes up a bit from instrumentation problems), select each of these ranges, and then spit out the slope of each?  Register To Reply

2. ## Re: calculate the slope of a range of numbers, if the numbers are more or less descending

Hi,

There's no reason why Excel can't react to a change in data and display the line slope, all you need to decide is what should be the trigger for the change.

If the data is connected to the Excel sheet then the data refresh can be scheduled as often as you like, otherwise you'd need to click a button or trigger in some other way. Once the data is refreshed you'd need to create a rolling period average in order to smooth out the effect of noise and then have Excel update and plot the points and slope line on a chart.  Register To Reply

3. ## Re: calculate the slope of a range of numbers, if the numbers are more or less descending

thanks Richard. I'm glad to hear it is doable. I suspect this has to be done through VBA? I am totally new to this sort of work with Excel and don't know where to start, unfortunately. I got as far as thinking, "something, something... conditional formatting... something..."  Register To Reply

There are currently 1 users browsing this thread. (0 members and 1 guests) 