PDA

View Full Version : How to Create Function for Matrix Multiplication



lehrymut14
05-21-2017, 03:09 PM
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

mikerickson
05-21-2017, 03:49 PM
My reply at your cross-post has a solution
https://www.mrexcel.com/forum/excel-questions/1006349-how-create-function-matrix-multiplication.html

SamT
05-21-2017, 04:18 PM
Sub test_MatrixMultiply()
MatrixMultiply ActiveSheet.Range("A1:C3"), ActiveSheet.Range("E1")
End Sub


Sub MatrixMultiply(Multiplicand As Range, Multiplier As Range)
Multiplier.Copy
Multiplicand.PasteSpecial xlPasteValues, xlPasteSpecialOperationMultiply
End Sub