Hi!
My function is working nicely when I have argument ranges horizontally. But if I am trying to use vertical data I cannot get it work. So I have to modify the following part of my code.
For lngRT = rngRT To 0 Step -1
dblPct = IIf(lngRT <> rngRT.Value, dblPct * (1 - rngPct(1 + lngRT).Value), rngPct(1 + lngRT).Value)
HTOTALCALLS = HTOTALCALLS + (rngAmt(1 + lngRT).Value * dblPct)
Next lngRT
Any ideas what I have to do? I struggled quite awhile now but cannot get it work..
rngPct(1 + lngRT).Value and rngAmt(1 + lngRT).Value are the ones i should be modifying..
Thanks for any help!
-Jack
Function VTOTALCALLS(rngRT As Range, rngAmt As Range, rngPct As Range) As Variant
Dim lngRT As Long, dblPct As Double
If Application.Count(rngRT, rngAmt, rngPct) <> Union(rngRT, rngAmt, rngPct).Cells.Count Then
HTOTALCALLS = "Input Error"
Exit Function
End If
For lngRT = rngRT To 0 Step -1
dblPct = IIf(lngRT <> rngRT.Value, dblPct * (1 - rngPct(0, 1 + lngRT).Value), rngPct(0, 1 + lngRT).Value)
HTOTALCALLS = HTOTALCALLS + (rngAmt(0, 1 + lngRT).Value * dblPct)
Next lngRT
End Function
Bookmarks