ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Custom function for Sum Product (Conditional Formula) (https://www.excelbanter.com/excel-discussion-misc-queries/170812-custom-function-sum-product-conditional-formula.html)

FARAZ QURESHI

Custom function for Sum Product (Conditional Formula)
 
I want to create a custom function like:

Public Function MyFormula(ARRAY1, ARRAY2, ARRAY3, STRING)
MyFormula=SUMPRODUCT(--(ARRAY1=STRING),--(ARRAY20),ARRAY3)
End Function

How to give it a correct and complete form?

Thanx!


Bob Phillips

Custom function for Sum Product (Conditional Formula)
 
Public Function MyFormula(ARRAY1, ARRAY2, ARRAY3, sSTRING)
MyFormula = Application.Caller.Parent.Evaluate( _
"SUMPRODUCT(--(" & ARRAY1.Address & "=""" & sSTRING & """),--(" & _
ARRAY2.Address & "0)," & ARRAY3.Address & ")")
End Function


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"FARAZ QURESHI" wrote in message
...
I want to create a custom function like:

Public Function MyFormula(ARRAY1, ARRAY2, ARRAY3, STRING)
MyFormula=SUMPRODUCT(--(ARRAY1=STRING),--(ARRAY20),ARRAY3)
End Function

How to give it a correct and complete form?

Thanx!




FARAZ QURESHI

Custom function for Sum Product (Conditional Formula)
 
THANX BOB!!!!!!!!!!!!!

U really made my problems solved!

I am really sorry for double posting but I was actually receiving no
response and had presumed that it might have been overlooked!

Thanx again buddy!

"Bob Phillips" wrote:

Public Function MyFormula(ARRAY1, ARRAY2, ARRAY3, sSTRING)
MyFormula = Application.Caller.Parent.Evaluate( _
"SUMPRODUCT(--(" & ARRAY1.Address & "=""" & sSTRING & """),--(" & _
ARRAY2.Address & "0)," & ARRAY3.Address & ")")
End Function


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"FARAZ QURESHI" wrote in message
...
I want to create a custom function like:

Public Function MyFormula(ARRAY1, ARRAY2, ARRAY3, STRING)
MyFormula=SUMPRODUCT(--(ARRAY1=STRING),--(ARRAY20),ARRAY3)
End Function

How to give it a correct and complete form?

Thanx!






All times are GMT +1. The time now is 08:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com