montecarlo2012
Well-known Member
- Joined
- Jan 26, 2011
- Messages
- 984
- Office Version
- 2010
- Platform
- Windows
Hi.
working with trendline, inserting in a loop, but I don't get any result. I already check Tushar Mehta, and excel tool set for the formulas, the formula I am now is:
Equation: y=c*x^b
c: =EXP(INDEX(LINEST(LN,LN(x),,),1,2))
Thanks.
working with trendline, inserting in a loop, but I don't get any result. I already check Tushar Mehta, and excel tool set for the formulas, the formula I am now is:
Equation: y=c*x^b
c: =EXP(INDEX(LINEST(LN,LN(x),,),1,2))
VBA Code:
Sub T_L()
Dim rngStart As Range, rngData As Range
Dim Diff1 As Long, Diff2 As Long, NoRows As Long, NoCols As Long, i As Long
Dim s As String
Set rngData = Range("B3:G2720")
NoRows = rngData.Rows.Count
NoCols = rngData.Columns.Count
Diff1 = 8: Diff2 = 35
Set rngStart = Range("I3").Resize(, NoCols)
For i = Diff1 To Diff2
With rngStart.Offset(, (NoCols + 1) * (i - Diff1)).Resize(NoRows - i)
.Rows(0).Formula = "=SUMPRODUCT(--(" & rngData.Resize(NoRows - i, 1).Address(0, 0) & "=" & .Columns(1).Address(0, 0) & "))"
.Rows(0).Font.Bold = True
'Equation: y=c*x^b
'c: =EXP(INDEX(LINEST(LN(y),LN(x),,),1,2))
.Formula = "= trunc(abs(EXP(INDEX(LINEST(LN(B3:B19),LN($A$3:$A$19),,),1,2))))"
s = .Cells(1, 1).Address(0, 0)
With .FormatConditions
.Delete
.Add Type:=xlExpression, Formula1:="=" & rngData(1, 1).Address(0, 0) & "=" & s
.Item(1).Interior.Color = vbYellow
End With
End With
Next i
End Sub