+ Reply to Thread
Results 1 to 9 of 9

Getting sumifs and dynamic ranges to work together

  1. #1
    Registered User
    Join Date
    09-15-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    42

    Getting sumifs and dynamic ranges to work together

    I have a dynamic table and 4 named ranges coming from the table.

    I have the following formula in the reference of the named range.
    =OFFSET(Ledger!$B$2,0,0,COUNT(Ledger!$B$2:Ledger!$B$2001),1)

    On a different sheet I have the following formula to add up the totals based on specific criteria.
    =SUMIFS(Withdraws,notes,"="&$J4,Date,"<"&INDEX(DTlookup,MATCH($I$4,months,0),3),Date,">="&INDEX(DTlookup,MATCH($I$4,months,0),4))

    I keep getting a value error. however if I change the named range reference to
    =OFFSET(Ledger!$B$2,0,0,COUNT(Ledger!$B$2:Ledger!$B$66),1) *"the table currently stops at row 66"* the sumifs formula works but it stops being dynamic and does not grow when new entries are entered.

    *note this is my first time trying to make a dynamic table or dynamic ranges.

    any help would be much appreciated.

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Getting sumifs and dynamic ranges to work together

    hard to say without seeing a sample workbook, but looking at your sumifs(), it looks wrong...

    =SUMIFS(Withdraws,notes,"="&$J4,Date,"<"&INDEX(DTlookup,MATCH($I$4,months,0),3),Date,">="&INDEX(DTlookup,MATCH($I$4,months,0),4)

    sumifs(criteria1-range, criteria1,criteria2-range, criteria2, etc....

    the bolded part looks wrong? looks like criteria1-range, criteria1-range, criteria1 ?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    09-15-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    42

    Re: Getting sumifs and dynamic ranges to work together

    budget.11.xlsx

    I don't think the sumifs is the problem. Withdraws is the sum-range which is before the 1st criteria in sumifs.

    If I change the named ranges (withdraws,notes and date) to Ledger!$E2:$E2000... it will work, but I don't want to have to come back into the file and change the formula later. And I would like to refer to the ranges by name instead of having to click and drag.

  4. #4
    Banned User!
    Join Date
    10-14-2006
    Posts
    1,211

    Re: Getting sumifs and dynamic ranges to work together

    You no need to create the named ranges when you are using "Table" format. The table is already created name ranges for each columns.

  5. #5
    Registered User
    Join Date
    09-15-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    42

    Re: Getting sumifs and dynamic ranges to work together

    hmmm, this is interesting. Okay, It works, thank you. However you have raised many more question about tables that I will have to figure out.
    To be honest the reasons I went with a table were because by hitting tab on the the last cell it added a line and the alternating colors(something I want in the file)

    Is a table format the best way to make this work?

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Getting sumifs and dynamic ranges to work together

    sorry, dont know where my head was when I posted that lol

  7. #7
    Banned User!
    Join Date
    10-14-2006
    Posts
    1,211

    Re: Getting sumifs and dynamic ranges to work together

    Is a table format the best way to make this work? It convience to use without reinvented the wheel

    I look some of your defined name ranges you created are not even correct, that why your formula is not working when you use those name ranges.

  8. #8
    Registered User
    Join Date
    09-15-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    42

    Re: Getting sumifs and dynamic ranges to work together

    that does not suprise me. what is not correct about them?

    FDibbins, no worries. I would be the richest man in the world if i had a nickle for every time I made a mistake.

  9. #9
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,697

    Re: Getting sumifs and dynamic ranges to work together

    It's only appropriate to use a dynamic named range like this one

    =OFFSET(Ledger!$B$2,0,0,COUNT(Ledger!$B$2:Ledger!$B$2001),1)

    where you have continuous numeric data.

    You have data down to row 70 but some blanks so, as there are only 18 deposit values the above just gives you the range Ledger!$B$2:$B$19, thus missing some of the values.

    As your other named ranges are based on the number of the values in different columns they are all different sizes - SUMIFS requires all the ranges to be the same size, so you get #VALUE! error.

    Try creating named ranges based on a column where all rows are populated, so Dates is OK as

    =OFFSET(Ledger!$A$2,0,0,COUNTA(Ledger!$A$2:$A$2001),1)

    but it's then best to base all your other named ranges on the COUNTA from that range, e.g. Withdraws can be

    =OFFSET(Ledger!$E$2,0,0,COUNTA(Ledger!$A$2:$A$2001),1)

    with just the start cell changed in the OFFSET function. Your other named ranges should follow that same pattern, then your SUMIFS should work
    Audere est facere

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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