+ Reply to Thread
Results 1 to 11 of 11

Dynamic SUMIFS range (Dynamic OFFSET)

  1. #1
    Registered User
    Join Date
    03-03-2022
    Location
    Stockholm, Sweden
    MS-Off Ver
    Excel for Mac 2016
    Posts
    4

    Dynamic SUMIFS range (Dynamic OFFSET)

    Hi,

    I need some help with a SUMIFS formula that will have a dynamic range whenever I dump the data into the spreadsheet. I've attached a sheet with some data, and I've used a table with the solution I want.

    I would like to SUMIFS each column and use the mapping in column A, how ever the range is dynamic from month to month, so for example for this month for Sales I have 56 rows of data that I would like to SUM, from Row 4 (Sales) to Row 59 (Total Sales), but the next month it might be 80 rows from (Sales) to (Total Sales), so I would like SUMIFS for each column everything between Sales and Total Sales.

    I would like to do the same for Marketing and Analytics below since these ranges vary from month to month.

    I've attached a solution with the fixed rows and columns, but this isn't dynamic and needs to be redone each month, which I would love to avoid.

    Many thanks
    Attached Files Attached Files
    Last edited by iop; 03-03-2022 at 05:32 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    07-23-2013
    Location
    London, England
    MS-Off Ver
    Office 365
    Posts
    988

    Re: Dynamic SUMIFS range (Dynamic OFFSET)

    I think a simple solution might be to have Sales, MArketing and Analytics all in separate columns. Then you can set the range to the whole column. If you need to keep them in the same column, adding another column with "Sales", "Marketing" or "Analytics" and using that inside your SUMIFS would work, alternatively having unique names in column A (e.g. SalesSalaries, MarketingSalaries, etc).

    I can't think of a simple solution otherwise without using VBA.

  3. #3
    Valued Forum Contributor
    Join Date
    07-23-2013
    Location
    London, England
    MS-Off Ver
    Office 365
    Posts
    988

    Re: Dynamic SUMIFS range (Dynamic OFFSET)

    Thought of a somewhat complicated solution though if you are wedded to the current format:

    Try this in cell J5:

    =SUMIFS(INDIRECT(ADDRESS(MATCH("Sales",$B:$B,0)+1,MATCH(J$3,$C$2:$G$2,0)+2) & ":" & ADDRESS(MATCH("Total Sales",$B:$B,0)-1,MATCH(J$3,$C$2:$G$2,0)+2)),INDIRECT(ADDRESS(MATCH("Sales",$B:$B,0)+1,1) & ":" & ADDRESS(MATCH("Total Sales",$B:$B,0)-1,1)),$I5)

    I tested and it gives the correct answer for all cells in your example sheet, if you change "Sales" for "Marketing" or "Analytics" in the relevant cells (just copy the formulae and then do a find & replace).

    Nick

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,422

    Re: Dynamic SUMIFS range (Dynamic OFFSET)

    Try:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    copied down and across.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  5. #5
    Registered User
    Join Date
    03-03-2022
    Location
    Stockholm, Sweden
    MS-Off Ver
    Excel for Mac 2016
    Posts
    4

    Re: Dynamic SUMIFS range (Dynamic OFFSET)

    Thanks!! That works great, but I guess it would be semi dynamic, since I would have to update the MATCHes for "Marketing" "Total Marketing" "Analytics" "Total Analytics".

  6. #6
    Registered User
    Join Date
    03-03-2022
    Location
    Stockholm, Sweden
    MS-Off Ver
    Excel for Mac 2016
    Posts
    4

    Re: Dynamic SUMIFS range (Dynamic OFFSET)

    Actually, I think this is great for the solution I had in mind. Thanks again!!

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,422

    Re: Dynamic SUMIFS range (Dynamic OFFSET)

    I would advocate NOT using INDIRECT as it is a volatile function and should be avoided if possible. See the alternative in post #4 which is also shorter.


    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

  8. #8
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,023

    Re: Dynamic SUMIFS range (Dynamic OFFSET)

    Set up 3 Named Ranges (Sales, Marketing & Analytics... CTRL-F3 to view/edit). This is sales

    =INDEX(Sheet1!$A:$G,MATCH(Sheet1!$I$4,Sheet1!$B:$B,0),):INDEX(Sheet1!$A:$G,MATCH("Total "&Sheet1!$I$4,Sheet1!$B:$B,0),)

    Then use variants of this formula, copied across and dnown:

    =SUMPRODUCT(--(INDEX(Sales,,1)=$I5)*(INDEX(Sales,,2+COLUMNS($J5:J5))))
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  9. #9
    Registered User
    Join Date
    03-03-2022
    Location
    Stockholm, Sweden
    MS-Off Ver
    Excel for Mac 2016
    Posts
    4

    Re: Dynamic SUMIFS range (Dynamic OFFSET)

    Thanks for all the solutions. Much appreciated!!

  10. #10
    Valued Forum Contributor
    Join Date
    07-23-2013
    Location
    London, England
    MS-Off Ver
    Office 365
    Posts
    988

    Re: Dynamic SUMIFS range (Dynamic OFFSET)

    Part of the reason my solution is longer is because I included a MATCH for the column heading as well, in case these should change. But I agree, it is better to avoid INDIRECT if possible. I did not realise you could use INDEX in this way (I thought you would need INDIRECT in any case to get the range reference to work), so good to learn, thanks!

    For completeness here is the INDEX version with the MATCH for columns added in.

    =SUMIFS(INDEX($C:$G,MATCH("Sales",$B:$B,0)+1,MATCH(J$3,$C$2:$G$2,0)):INDEX($C:$G,MATCH("Total Sales",$B:$B,0)-1,MATCH(J$3,$C$2:$G$2,0)),INDEX($A:$A,MATCH("Sales",$B:$B,0)+1):INDEX($A:$A,MATCH("Total Sales",$B:$B,0)-1),$I5)

  11. #11
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,023

    Re: Dynamic SUMIFS range (Dynamic OFFSET)

    You're welcome.



    It would be very nice if you were to just click the Add Reputation button at the foot of any of the posts of members who helped you reach a solution.

    Finally, if that takes care of your original question, please select "Thread Tools" from the menu link (just above the first post in the thread) and mark this thread as SOLVED.

+ 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] Help with SUMIFS with dynamic range VBA
    By LilSisKin in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-02-2021, 06:35 PM
  2. [SOLVED] SUMIFS with dynamic Sum Range
    By DJvdW in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 07-09-2019, 09:20 AM
  3. [SOLVED] SUMIFS for dynamic range
    By Keibri in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-06-2018, 04:37 AM
  4. [SOLVED] Using OFFSET For Dynamic Ranges Along With SUMIFS?
    By Mvaldesi in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 03-28-2018, 08:53 AM
  5. [SOLVED] Dynamic range sumifs
    By eggselent in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-24-2016, 12:53 PM
  6. Replies: 1
    Last Post: 04-10-2015, 11:53 AM
  7. [SOLVED] SUMIFS with a dynamic, offset criteria range
    By adelcap in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-22-2014, 05:35 AM

Tags for this Thread

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