Custom function for Sum Product (Conditional Formula)

F

FARAZ QURESHI

I want to create a custom function like:

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

How to give it a correct and complete form?

Thanx!
 
B

Bob Phillips

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)
 
F

FARAZ QURESHI

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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top