Thread: Probabilities
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Leith Ross[_680_] Leith Ross[_680_] is offline
external usenet poster
 
Posts: 1
Default Probabilities


Hello Phil2006,

Here is macro that should do what you need.


Code:
--------------------

Public Function SumScalarProduct(Scalar As Double, ProductArray As Range)
Dim ProdCell As Range
Dim Total

For Each ProdCell In ProductArray
Total = Total + (Scalar.Value * ProdCell.Value)
Next ProdCell

SumScalarProduct = Total
End Function

--------------------


Example of using the Macro:
Result = SumScalarProduct(Range("A1").Value, Range("B1:B20"))

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=563982