Consulting

Results 1 to 5 of 5

Thread: Maximum Limit for MMULT()

  1. #1
    VBAX Newbie badri.toppur's Avatar
    Joined
    Nov 2009
    Location
    Udupi, India
    Posts
    5
    Location

    Maximum Limit for MMULT()

    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
    Attached Files Attached Files

  2. #2
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,058
    Location
    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
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  3. #3
    Knowledge Base Approver VBAX Wizard
    Joined
    Apr 2012
    Posts
    5,645
    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

  4. #4
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,726
    Location
    You have empty cells in CMatrix. Make them all 0's

    Capture.JPG

    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

    Capture.JPG
    Attached Files Attached Files
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  5. #5
    VBAX Newbie badri.toppur's Avatar
    Joined
    Nov 2009
    Location
    Udupi, India
    Posts
    5
    Location
    Quote Originally Posted by Paul_Hossler View Post
    You have empty cells in CMatrix. Make them all 0's

    Capture.JPG

    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

    Capture.JPG

    Paul Hossler,
    Thanks for writing that Check() function. I am now able to calculate using the Matrix formulae.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •