Thread: Function
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Function

Not like that

Function ShiftHours(a As Range, b, c As Range, d, e As Range)
Dim sFormula As String

sFormula = "SumProduct(--(" & a.Address & "=""" & b & """)," & _
"--(" & c.Address & "=""" & d & """)," & _
e.Address & ")"
ShiftHours = Application.Caller.Parent.Evaluate(sFormula)

End Function


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"ceemo" wrote in
message ...

I have been trying to create my own function whilst including other
functions. Please see below example


Function ShiftHours(a, b, c, d, e)

ShiftHours = SumProduct(--(a = b), --(c = d), e)

End Function

This however doesnt work. Can i use functions within functions?

If so how would i use an aray function that would normaly require me to
use shift&Control&Enter at the same time


--
ceemo
------------------------------------------------------------------------
ceemo's Profile:

http://www.excelforum.com/member.php...o&userid=10650
View this thread: http://www.excelforum.com/showthread...hreadid=558846