+ Reply to Thread
Results 1 to 11 of 11

SUMIF with dynamic sum range

  1. #1
    Registered User
    Join Date
    12-23-2014
    Location
    London
    MS-Off Ver
    2010
    Posts
    5

    SUMIF with dynamic sum range

    I have a variable (name) in one worksheet and I want to look it up from another worksheet and sum all values against this variable for a range of months (again variable).
    I want the user to select the "name" in a cell and specify the months in another set of cells i.e. "Month from" and "Month to" and I want a formula that will look for the name in a list and sum the values corresponding to all the months including the "Month from" and "Month to". The added difficulty is that the name can have multiple entries in the list and hence I have to use SUMIF.

    I have tried a combination of SUMIF, OFFSET, MATCH, HLOOKUP funtions, but I am struggling as the sumif funtion is adding only the values in one column and not in multiple columns and my sum range is a dynamic range depending on the user selection.

    Would be grateful for some help. Thanks!!

  2. #2
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: SUMIF with dynamic sum range

    I'm not sure why you would need more than just SUMIFS.

    Could you post a sample workbook?

    BSB.

  3. #3
    Registered User
    Join Date
    12-23-2014
    Location
    London
    MS-Off Ver
    2010
    Posts
    5

    Re: SUMIF with dynamic sum range

    Many thanks, I have attached a sample. The selection worksheet shows the variables and the Data worksheet has the data to be looked up
    Attached Files Attached Files

  4. #4
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: SUMIF with dynamic sum range

    A slightly different data layout to what I was expecting so SUMIFS is not your friend here.
    However, try the below formula and see if does what you need.

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    BSB
    Attached Files Attached Files
    Last edited by BadlySpelledBuoy; 12-23-2014 at 11:41 AM. Reason: With attachment this time.

  5. #5
    Registered User
    Join Date
    12-23-2014
    Location
    London
    MS-Off Ver
    2010
    Posts
    5

    Re: SUMIF with dynamic sum range

    This is fantastic! It works and the formula is so simple. I had some #N/As in my name list which were causing the formula not to work, but after eliminating them it works perfectly fine.
    Thanks very very much BSB, you saved me from having to work over xmas :-)

  6. #6
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: SUMIF with dynamic sum range

    You could wrap the whole thing in IFERROR to take care of the N/A errors....

    Happy to help
    Have a good Christmas

    BSB

  7. #7
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: SUMIF with dynamic sum range

    Don't forget to mark the thread as SOLVED.

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

    Re: SUMIF with dynamic sum range

    Quote Originally Posted by msp_excel View Post
    ...I had some #N/As in my name list which were causing the formula not to work....
    Probably best to eliminate those as you say you have....but a switch to an "array formula" will give you correct results even with some #N/A errors in Data!B3:B14, i.e.

    =SUM(IF(ISNA(Data!B3:B14),0,IF((Data!B3:B14=C4)*(Data!C2:AB2>=D4)*(Data!C2:AB2<=E4),Data!C3:AB14)))

    confirmed with CTRL+SHIFT+ENTER
    Audere est facere

  9. #9
    Registered User
    Join Date
    12-23-2014
    Location
    London
    MS-Off Ver
    2010
    Posts
    5

    Re: SUMIF with dynamic sum range

    Yes!! this works as well. Many thanks for this.

    I've just two simple ways of doing this :-)

  10. #10
    Registered User
    Join Date
    12-23-2014
    Location
    London
    MS-Off Ver
    2010
    Posts
    5

    Re: SUMIF with dynamic sum range

    How do I do that? I see people prefix solved to the thread title - how can I edit the title? Thanks

  11. #11
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: SUMIF with dynamic sum range

    Quote Originally Posted by msp_excel View Post
    How do I do that? I see people prefix solved to the thread title - how can I edit the title? Thanks
    Have a look here:
    http://www.excelforum.com/faq.php

+ 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. Sumif with dynamic range
    By XL2008 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-06-2014, 01:17 PM
  2. Sumif and dynamic range
    By Bpd in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-08-2013, 01:36 AM
  3. SUMIF Dynamic Range
    By M1234 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-23-2013, 01:14 PM
  4. sumif with dynamic value range
    By vinayakg in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 05-19-2013, 09:08 AM
  5. Sumif for dynamic range
    By Praneetbvb in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-02-2012, 07:14 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