VBA LOOPING FORMULA TREND

montecarlo2012

Well-known Member
Joined
Jan 26, 2011
Messages
984
Office Version
  1. 2010
Platform
  1. Windows
Hello everyone, Hoping you got good weekend and safe.
PLEASE, hard time figuring things out here with looping a formula.
The same formula must be entered in the successive cells columns, the formula must be incremented By one row.

The reading area to apply the formula contains a dynamic array of data, in (“B2:G2800”) at the moment
The formula TREND of each Column in the data BLOCK is to be calculated and entered in the first
8 rows of columns;
if any result match, like B with B or C with C highlight and count beyond column I

CELLS(I3 , N).FORMULA=TRUNC(TREND(B3:B11))
CELLS(I4 , N).FORMULA=TRUNC(TREND(B4:B12))
CELLS(I5 ,N).FORMULA=TRUNC(TREND(B5:B13))
CELLS(I6 , N).FORMULA=TRUNC(TREND(B6:B14)) The difference is 8



In the answer area (“P:N”) the formula would be increase again
CELLS(P3 , U).FORMULA=TRUNC(TREND(B3:B12))
CELLS(I4 , U).FORMULA=TRUNC(TREND(B4:B13))
CELLS(I5 , U).FORMULA=TRUNC(TREND(B5:B14))
CELLS(I6 , U).FORMULA=TRUNC(TREND(B6:B15)) The difference is 9

I want to keep going until the difference is equal to 35
On “I3” you see the number 3 is because three time the numbers on column B, match the results on B.

Ctrend.PNG
 
StephenCrump, Sorry about this, I just now have time to really work with the code, and I realize something about the values in the row 3,
I am not getting any results, all I see is Value#, Value# etc. and about the 2800 rows is just a reference quantity at the present time, but the array is dynamic I was thinking maybe use lastrow.count instead of the 2800, maybe ?, my
apology for this comment Sir.
Thank you again for reading this post.
 
Upvote 0

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Thank you StephenCrump, I make a mistake, I founded and now is perfect, thanks again, I was wrong and you are right, sorry.
 
Upvote 0

Forum statistics

Threads
1,215,059
Messages
6,122,917
Members
449,093
Latest member
dbomb1414

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