Formula to Detect Trends Over Time

carterc

New Member
Joined
Aug 16, 2019
Messages
1
Please bear with this explanation as it may be lengthy but I want to be as clear as possible with my problem..

I am trying to detect with a formula the trend over the past 6 months of my data. I do not simply want to see if the data has increased from one month to the next month; rather I want to find the overall trend throughout the past 6 months of data (Please note that this data will be updated monthly and thus needs to be dynamic). I have some automation worked in with custom formatting that will output an arrow dependent on the value of the trend of the line I am analyzing. I need help with creating a formula that works consistently to detect an upwards, downwards, and flat trend. This formula will also need to ignore blanks in selection area. There are other posts with similar problems but no solutions that fit my needs.

Here is what I currently have as a formula to solve this problem. I thought I had solved it at first but this formula will only work with a certain size of numbers, anything too small or too large and it wont behave properly for my needs.

[TABLE="width: 500"]
<tbody>[TR]
[TD]Cost Trending[/TD]
[TD]Jan[/TD]
[TD]Feb[/TD]
[TD]Mar[/TD]
[TD]Apr[/TD]
[TD]May[/TD]
[TD]Jun[/TD]
[TD]Jul[/TD]
[TD]Aug[/TD]
[TD]Sep[/TD]
[TD]Oct[/TD]
[TD]Nov[/TD]
[TD]Dec[/TD]
[/TR]
[TR]
[TD]2018[/TD]
[TD]184[/TD]
[TD]25[/TD]
[TD]30[/TD]
[TD]30[/TD]
[TD]64[/TD]
[TD]87[/TD]
[TD]63[/TD]
[TD]6.8[/TD]
[TD]35[/TD]
[TD]66[/TD]
[TD]21[/TD]
[TD]81[/TD]
[/TR]
[TR]
[TD]2019[/TD]
[TD]847[/TD]
[TD]858[/TD]
[TD]627[/TD]
[TD]678[/TD]
[TD]294[/TD]
[TD]484[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

=IF(LINEST(OFFSET(A3,0,COUNTA(B3:M3),1,-6))>0.9,10,IF(LINEST(OFFSET(A3,0,COUNTA(B3:M3),1,-6))<-0.9,-10,0.5))

**Where B3:M3 is 2019 Jan-Jun data and A3 references "2019" for offset function.

When there is an upwards trend, I would like to return a positive number greater than 1 (I chose 10 just because). If there is a downwards trend I want to display a negative number less than -1 (I chose -10 just because). If there is a flat trend, I want to display a number between 0.1-0.9b (I chose 0.5 just because).

The formula I currently have works for some sized numbers but not others (for example this formula currently works with the sample data set above and returns a "-10" to represent a downward trend). The problem arises when I encounter very small or very large data sets.

[TABLE="width: 500"]
<tbody>[TR]
[TD]Cost Trending[/TD]
[TD]Jan[/TD]
[TD]Feb[/TD]
[TD]Mar[/TD]
[TD]Apr[/TD]
[TD]May[/TD]
[TD]Jun[/TD]
[TD]Jul[/TD]
[TD]Aug[/TD]
[TD]Sep[/TD]
[TD]Oct[/TD]
[TD]Nov[/TD]
[TD]Dec[/TD]
[/TR]
[TR]
[TD]2018[/TD]
[TD]2.2[/TD]
[TD]3.1[/TD]
[TD]2.8[/TD]
[TD]3.1[/TD]
[TD]1.8[/TD]
[TD]2.1[/TD]
[TD]1.9[/TD]
[TD]2.5[/TD]
[TD]3.1[/TD]
[TD]3.2[/TD]
[TD]2.9[/TD]
[TD]3.2[/TD]
[/TR]
[TR]
[TD]2019[/TD]
[TD]3.2[/TD]
[TD]3.4[/TD]
[TD]4.1[/TD]
[TD]5.2[/TD]
[TD]6.2[/TD]
[TD]7.5[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

With this data set above, my formula would return a "0.5" to indicate a flat trend, when it is clear that 2019 Jan-Jun is increasing.

I am open to other solutions to solve this problem but I think my formula could be close with some tweaks. I've searched all across the forums and google and have not seen any solution to solve this. Please note that detecting a flat trend is a necessity with this scenario otherwise I would be able to solve this fairly easily.

I would really appreciate any insights or solutions anyone can offer! Please don't hesitate to ask for clarification in any area and I would be glad to.

Thanks!!

Carter
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.

Forum statistics

Threads
1,224,820
Messages
6,181,161
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top