more factors needed for an SP UDF
You will need to reverse the arguments, and dec places will be mandatory
Function mySP(dec As Long, ParamArray rng())
Dim sRanges As String
Dim i As Long
For i = LBound(rng) To UBound(rng)
sRanges = sRanges & rng(i).Address(, , , True) & "*"
Next i
mySP = Evaluate("=SumProduct(Round(" & _
Left(sRanges, Len(sRanges) - 1) & "," & dec & "))")
End Function
Use like
=mySP(2, A1:A100,B1:B100,C1:K100)
--
---
HTH
Bob
(change the xxxx to gmail if mailing direct)
"dribler2" wrote in message
...
I gain a UDF fed thru another post and this works for something like this
=mySP(A1:A100,C1:K100,2) [2 dimensional with one and a series of factors]
'------------------------------------------------
Function mySP(rng1 As Range, rng2 As Range, Optional dec As Long = 15)
mySP = Evaluate("=SumProduct(Round(" & rng1.Address(, , , True) & "*" &
rng2.Address(, , , True) & "," & dec & "))")
End Function
'-----------------------------------------------
Yet I need to know if it is still possible to move more farther with
something like this
=mySP(A1:A100,B1:B100,C1:K100,2) ---the above current UDF gaves me a
#VALUE!
for a 3 or more dimensional with a max. series of factors.
hope someone out there can understand to help me with this...
happy holidays,
dribler2
|