View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
21MSU 21MSU is offline
external usenet poster
 
Posts: 1
Default SumProduct function

I am creating the following Excel function

Function BlendFlashPt_degF(volpct_data As Range, CompFlashPt_degF As
Range) As Variant

Dim FPI As Double

FPI = Application.WorksheetFunction.SumProduct(volpct_da ta, 10 ^
(-6.1188 + (4345.2 / ((CompFlashPt_degF) + 383))))

BlendFlashPt_degF = (4345.2 / (Log(FPI) / 2.302585092994 + 6.1188)) -
383

End Function

But, I am getting

run-time error 13
'type mismatch'

on the line
FPI = Application.WorksheetFunction.SumProduct(volpct_da ta, 10 ^
(-6.1188 + (4345.2 / ((CompFlashPt_degF) + 383))))

However, when I typed this formula

SUMPRODUCT(B17:M17,10^(-6.1188+(4345.2/((B37:M37)+383))))

into Excel's formula bar it worked.
where B17:M17 represents volpct_data
B37:M37 represents CompFlashPt_degF

What I am doing wrong in my user-defined function?

Please Help!
Thanks!


---
Message posted from http://www.ExcelForum.com/