[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 494
  • Last Modified:

SUMPRODUCT Multiple Sheets

Hi I have problems working with SUMPRODUCTS on a good day.  I have a sample workbook that I would like to Sum columns f (qty needed); g (qty on hand) and h (missing) based on the text in column b (part number) for all tabs to the right of the Summary tab and return the results on the Summary worksheet. When the worksheet is complete there will 23 different tabs not including the Summary tab.  Is it possible to use SUMPRODUCT to do this?

1 Solution
Joe CarmanCommented:
I have the same challenge. Following.
Ejgil HedegaardCommented:
Not sure it is possible to use multiple sheets in the Sumproduct function, but a VBA function can loop the sheets and do a SumIF on each.
Function SumIfSummary(Match As String, ColumnToMatch As String, ColumnToSum As String) As Double
    Dim ws As Worksheet

    For Each ws In ThisWorkbook.Worksheets
        If ws.Name <> "Summary" Then
            SumIfSummary = SumIfSummary + WorksheetFunction.SumIf(ws.Range(ColumnToMatch & ":" & ColumnToMatch), Match, ws.Range(ColumnToSum & ":" & ColumnToSum))
        End If
    Next ws
End Function

Open in new window

There are 3 arguments to the function
Match: The Part number in column C on sheet Summary.
ColumnToMatch: The column to match on the other sheets as text, "B".
ColumnToSum: The column to sum on the other sheets as text, "F" or "G" or "H".

See file.
jmac001Author Commented:
Thanks very much

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now