View Full Version : Maximum Limit for MMULT()
badri.toppur
06-12-2020, 08:53 PM
Hello, it has been a while since I visited VBA Express.
I am trying to to form a quadratic formula,  x'Ax, where A is of dimension 144 x 144, and x is of dimension 144 x 1.
Are they too large for MMULT()?
I keep getting #VALUE! after pressing CTRL+SHIFT+ENTER.
I am attaching the workbook, if anybody wants to take a look.
Best Regards,
Badri
Aussiebear
06-12-2020, 09:25 PM
Normally speaking the formula layout is = {MMult(Array1,Array2)}, but I notice you are using =MMULT(CMatrix,CMatrix).  Try using Control Shift Enter to enter the formula
In EP2: =A2^2
Then autofill the complete matrix
Sub M_snb()
   With Sheet5.Cells(2, 146)
       .value= "=A2^2"
       .AutoFill .Resize(, 12 ^ 2), 1
       .Resize(, 12 ^ 2).AutoFill .Resize(12 ^ 2, 12 ^ 2)
   end with
End Sub
Paul_Hossler
06-13-2020, 07:21 AM
You have empty cells in CMatrix. Make them all 0's
26820
Option Explicit
Sub Check()
    Dim i As Long, j As Long
    For i = 1 To 144
        For j = 1 To 144
            If VarType([CMatrix].Cells(i, j).Value) = vbEmpty Then
                Debug.Print "Row = " & i & ", Column = " & j
                [CMatrix].Cells(i, j).Value = 0
            End If
        Next j
    Next i
End Sub
26822
badri.toppur
06-13-2020, 07:46 PM
You have empty cells in CMatrix. Make them all 0's
26820
Option Explicit
Sub Check()
    Dim i As Long, j As Long
    For i = 1 To 144
        For j = 1 To 144
            If VarType([CMatrix].Cells(i, j).Value) = vbEmpty Then
                Debug.Print "Row = " & i & ", Column = " & j
                [CMatrix].Cells(i, j).Value = 0
            End If
        Next j
    Next i
End Sub
26822
Paul Hossler,
Thanks for writing that Check() function. I am now able to calculate using the Matrix formulae.
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.