How to Create Function for Matrix Multiplication

lehrymut14

New Member
Joined
May 21, 2017
Messages
1
Hi,

I have some problem with function of MMULT in excel.
I want to do sample two matrix multiplication by MMULT function.
X matrix at a given interval and k is a function that multiplies the matrix for the value of the number.


Many thanks for your help.


Example: Selected cells in the range A1 and C3, and Let k be the value of 3 (k=3).


=MatrixMultiply(A1:C3;3) -->> will give result




Function MatrixMultiply(X As Range, k As Integer) As Variant
.
.
.
End Function
‘---------------------------
‘Sample Use
‘-----------------------
Sub Test()
.
.
.
End Sub
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
For scalar multiplication of a matrix:
If you have a matrix at A1:C3 and a number at G1, then select A5:C8, type =G1*A1:C3 into the formula bar. Press Ctrl-Shift-Enter and the product will be shown.

There is no need for a UDF.
 
Upvote 0
Welcome to Mr Excel

See
https://support.office.com/en-us/article/MMULT-function-40593ED7-A3CD-4B6B-B9A3-E4AD3C7245EB

In the first remark you can see
"The number of columns in Array1 must be the same as the number of rows in Array2, and both arrays must contain only numbers."

Say you have this in A1:C3

[TABLE="class: grid"]
<tbody>[TR]
[TD="bgcolor: #DCE6F1"][/TD]
[TD="bgcolor: #DCE6F1"]
A
[/TD]
[TD="bgcolor: #DCE6F1"]
B
[/TD]
[TD="bgcolor: #DCE6F1"]
C
[/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
1
[/TD]
[TD]
1​
[/TD]
[TD]
2​
[/TD]
[TD]
3
[/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
2
[/TD]
[TD]
4​
[/TD]
[TD]
5​
[/TD]
[TD]
6​
[/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
3
[/TD]
[TD]
7​
[/TD]
[TD]
8​
[/TD]
[TD]
9​
[/TD]
[/TR]
</tbody>[/TABLE]


What exactly are you trying to do? Expected result(s)?

M.
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,246
Members
452,623
Latest member
cliftonhandyman

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top