+ Reply to Thread
Results 1 to 8 of 8

SUMIFS across multiple sheets using multiple criteria function not working

  1. #1
    Forum Contributor
    Join Date
    02-23-2007
    Location
    England
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2208 Build 16.0.15601.20072) 64-bit
    Posts
    102

    SUMIFS across multiple sheets using multiple criteria function not working

    Good evening all

    I apologise for I have read all of the posts on this very subject but none of the solutions work for me. Attached I have an example spreadsheet where I want the summary sheet (sheet 4 in this example) to sum all of the meals from all of the month sheets for each user. I have named my range for the months (Jan, Feb Mar) and even error wrapped the code, but it just will not work. Before you take a look, the formula I am using is:

    =IFERROR(SUMPRODUCT(SUMIFS(INDIRECT("'"&Dates&"'!C8:C31),Sheet4!J2,INDIRECT(Sheet4!&Dates&"'!A8:A31),INDIRECT("'"&Dates&"'!A8:A31),Sheet4!A3))),)

    I am trying this formula is cell B3 initially and once correct will amend and place in the cells B3 through to E7.

    Please could someone help me over the line as I believe the code isn't too far off.
    Many thanks in advance
    G1
    Attached Files Attached Files

  2. #2
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: SUMIFS across multiple sheets using multiple criteria function not working

    Change the definition of your named range Dates so that it excludes the B1 value, i.e. it should refer to the months only, =Ref!$B$2:$B$4
    Then use this formula in B3 copied across and down

    =SUMPRODUCT(SUMIFS(INDIRECT("'"&Dates&"'!C8:C31"),INDIRECT("'"&Dates&"'!A8:A31"),$A3,INDIRECT("'"&Dates&"'!B8:B31"),B$2))
    Audere est facere

  3. #3
    Forum Contributor
    Join Date
    02-23-2007
    Location
    England
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2208 Build 16.0.15601.20072) 64-bit
    Posts
    102

    Re: SUMIFS across multiple sheets using multiple criteria function not working

    Hello Daddylonglegs

    Thanks for your reply sir. I've left me spreadsheet at home so will check and get back to you later.

    Thanks
    G1

  4. #4
    Forum Contributor
    Join Date
    02-23-2007
    Location
    England
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2208 Build 16.0.15601.20072) 64-bit
    Posts
    102

    Re: SUMIFS across multiple sheets using multiple criteria function not working

    Good evening daddylonglegs

    First of all thank you for your code, it does exactly what I was trying to achieve. If I may ask one more additional question, as you have noticed my workbook only has 3 months on it. A new sheet will be added each month as the year goes by. As such I wanted to change the definition range to incorporate the remaining 9 months, and to 'future proof' the code by error wrapping it as listed below, so the code would still work even if the definition months are not yet created. But this does not work. Is there an easy way to do this or is it a case of just having to amend the definition range after the new month is added?

    =IFERROR(SUMPRODUCT(SUMIFS(INDIRECT("'"&Months&"'!C8:C31"),INDIRECT("'"&Months&"'!A8:A31"),$A4,INDIRECT("'"&Months&"'!B8:B31"),B$2)),)

    Thanks again Sir

    G1

  5. #5
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: SUMIFS across multiple sheets using multiple criteria function not working

    You can use IFERROR and still get a result when some of the sheets don't exist, but IFERROR needs to be around the SUMIFS function (which is returning the error in this case).

    Also adding IFERROR means the formula needs "array entry", so try this version

    =SUM(IFERROR(SUMIFS(INDIRECT("'"&Dates&"'!C8:C31"),INDIRECT("'"&Dates&"'!A8:A31"),$A3,INDIRECT("'"&Dates&"'!B8:B31"),B$2),0))

    confirmed with CTRL+SHIFT+ENTER

  6. #6
    Forum Contributor
    Join Date
    02-23-2007
    Location
    England
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2208 Build 16.0.15601.20072) 64-bit
    Posts
    102

    Re: SUMIFS across multiple sheets using multiple criteria function not working

    Good evening sir

    It's Sat night so don't expect to hear from you until next week.

    Just to say thanks again. The code works but now it's only summing from 1 sheet and not all sheets. Would the SUMPRODUCT instruction need to be re-added or maybe it's just a case of me amending the range as I add a new sheet (which isn't too much of a hassle to do).

    Many thanks
    G1

  7. #7
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: SUMIFS across multiple sheets using multiple criteria function not working

    For that last formula I posted you need to "array enter" it.

    Put the formula in a cell, select that cell then press F2 key to select formula. Now hold down CTRL and SHIFT keys while pressing ENTER. If you do that correctly then you will see curly braces like { and } around the formula in the formula bar

  8. #8
    Forum Contributor
    Join Date
    02-23-2007
    Location
    England
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2208 Build 16.0.15601.20072) 64-bit
    Posts
    102

    Re: SUMIFS across multiple sheets using multiple criteria function not working

    Daddylonglegs, you are an absolute wizard sir, thank you for helping me out. It worked perfectly.

    Thanks again and have a good night

    Until the next time

    G1

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Multiple SUM Criteria - DSUM and SUMIFS not working :-(
    By Coeus in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-15-2015, 04:05 PM
  2. [SOLVED] SUMIFS/COUNTIFS array function question (multiple criteria)
    By akamenov88 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-11-2015, 07:08 PM
  3. Replies: 5
    Last Post: 02-06-2015, 08:44 PM
  4. [SOLVED] SUMIFS with multiple criteria between sheets
    By PrncssJ in forum Excel Formulas & Functions
    Replies: 18
    Last Post: 03-24-2014, 01:31 PM
  5. SUMIFS w/ multiple criteria and an or function
    By jacobkmc in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-12-2013, 09:22 PM
  6. Using a SUMIFS across multiple sheets with multiple criteria
    By Auto667 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-06-2013, 06:55 AM
  7. Replies: 2
    Last Post: 01-23-2013, 06:25 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1