A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

thanks again and again



 
 
Thread Tools Display Modes
  #1  
Old January 2nd, 2007, 11:35 PM posted to microsoft.public.excel.worksheet.functions
driller
external usenet poster
 
Posts: 698
Default thanks again and again

thanks to excel forum...
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
------------------
'=mySPX("POS",2,L1:L3,M1:M3,N1:N3,,,,)
'for sum of negative products
'=mySPX("NEG",2,L1:L3,M1:M3,N1:N3,,,,)
'for sum of positive products
'=mySPX("ALL",2,L1:L3,M1:M3,N1:N3,,,,)
'for sum of both
-------------------------
hope to collect/achieve more,
driller
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:32 AM.


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