#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 740
Default thanks again

As myMilestone for myParticipation in this forum, i have derived [without
knowing VB] a certain UDF for those who like to have a direct function on
getting the rounded products of multiple factors, maybe accountants or
auditors may need it by using excel program....

sum of factored [virgin or rounded] product :[positive or negative or both]

this is dedicated to Bob Phillips, Jerry Lewis and Gary''s Student. who
helped me sort it out.

--------
Function mySPX(test, dec As Long, ParamArray rng())
Dim sConditions As String
Dim sRanges As String
Dim i As Long

sConditions = "--(" & rng(0).Address(False, False, , False)
sRanges = "ROUND(" & rng(0).Address(False, False, , False)
For i = LBound(rng) + 1 To UBound(rng)
sConditions = sConditions & "*" & rng(i).Address(False, False, , False)
sRanges = sRanges & "*" & rng(i).Address(False, False, , False)
Next i
If test = "POS" Then
mySPX = Evaluate("Sum(" & sConditions & "0)*" & sRanges & "," & dec & "))")
ElseIf test = "NEG" Then
mySPX = Evaluate("Sum(" & sConditions & "<0)*" & sRanges & "," & dec & "))")
ElseIf test = "ALL" Then
mySPX = Evaluate("Sum(" & sRanges & "," & dec & "))")
End If
End Function
------------------
'=mySPS("POS",2,L1:L3,M1:M3,N1:N3,,,,)
'for sum of negative products
'=mySPS("NEG",2,L1:L3,M1:M3,N1:N3,,,,)
'for sum of positive products
'=mySPS("ALL",2,L1:L3,M1:M3,N1:N3,,,,)
'for sum of both
-------------------------
hope to collect/achieve more,
driller
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 05:32 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"