Results 1 to 5 of 5

Thread: Mismatch for Sumproduct

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Mismatch for Sumproduct


    I am trying to add values to a range. Earlier I used to give a formula to first cell and extend, but I was required to set calculation to automatic in order to process those cells and it started to run too slow. I am trying to add the values to an array and then add the array back as values, but I am getting a mismatch error for a worksheetfunction.sumproduct and I can't figure the cause. Any help would be appreciated!

    For i = 1 to 3 ' this would be the column
        For r = 3 To lRow
            dataArray(r, 1) = WorksheetFunction.SumProduct( _
            (Right(ws.Range("D2: D" & lRow), 4) = ws.Cells(2, lCol + 1 + i).Value) * _
            (ws.Range("R2:R" & lRow) = ws.Cells(r, "B").Value) * _
            (ws.Range("AC2:AC" & lRow)))
    r, lCol, lRow are long, dataArray is variant: ReDim dataArray(1 To lRow, 1 To 1)

    Error is run-time error 13 - type mismatch

    Last edited by mikejo; 09-23-2023 at 04:57 AM. Reason: Added code tags to supplied code

Posting Permissions

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