ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Probabilities (https://www.excelbanter.com/excel-programming/368029-probabilities.html)

phil2006[_30_]

Probabilities
 

I have a number of probabilities and need to multiply them by numerous
other probabilities. Is there any way of multiplying cell A1 by cells
B1:b20 and summing the totals?

Thanks


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


Leith Ross[_680_]

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


Tom Ogilvy

Probabilities
 
=SUMPRODUCT(A1*B1:B10)

--
Regards,
Tom Ogilvy


"phil2006" wrote in
message ...

I have a number of probabilities and need to multiply them by numerous
other probabilities. Is there any way of multiplying cell A1 by cells
B1:b20 and summing the totals?

Thanks


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





All times are GMT +1. The time now is 04:11 AM.

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