So I thought I was tasked with a pretty simple objective however, it turns out I'm an struggling with it.
I have a really simple piece of code I want to execute and the idea behind the is numeric function means it skips cells that are not numeric and only places numerical values into the calculation. GREAT. However, I wanted it to extend the Length Variable by 1 so that for every blank it would add an extra number to keep the true value of Length the same.
however I can't get this to work. MY isnumeric function seems to do nothing.
Can someone help?
Function RSE(MyCells As Range, Length As Double)
Dim up_day, down_day, ups, downs
Dim average_up, average_down
Dim rs, cellcount, rangecount As Long
Dim cll As Range
ups = 0
up_day = 0
downs = 0
down_day = 0
cellcount = 0
rangecount = 0
For Each cll In MyCells
If IsNumeric(cll) Then
cellcount = cellcount + 1
If cellcount = Length Then Exit For
If cll.Value >= cll.Offset(1, 0).Value Then
downs = downs + cll - cll.Offset(1, 0).Value
ElseIf cll.Value < cll.Offset(1, 0).Value Then
ups = ups + cll.Offset(1, 0).Value - cll.Value
End If
Else:
Length = Length + 1
End If
Next cll
average_up = ups / Length
average_down = downs / Length
rs = average_up / average_down
RSE = 100 - (100 / (1 + rs))
End Function