+ Reply to Thread
Results 1 to 7 of 7

dynamic sumif function

Hybrid View

  1. #1
    Registered User
    Join Date
    06-01-2009
    Location
    Selangor, Malaysia
    MS-Off Ver
    Excel 2003
    Posts
    3

    dynamic sumif function

    Hi

    I'm trying to create a sumif formula that finds the column the information is
    in that it needs to sum. I have attached a copy of the file I'm trying to create a formula to get results that I want.

    Generally you would normally use the "=SUMIF(range,criteria,sumrange)". I was wondering if there was a formula I can substitute "sumrange" to also search a range of data (Eg: "G16:DA28"). I need the range to be dynamic as the column to be sum can change based on the criteria/option button being selected from the product category. I assume there is an indirect function involved, but I am not familiar with it. If you have a better and less complicated formula please suggest.

    This formula have been driving me up the wall and I appreciate any help I can get on this.

    Also, I appreciate if you can give me the formula string for ease of reference and testing as I'm not an expert in excel. So try to be as detail as you can.

    Thank you in advance!!!

    Cheers
    Patrick
    Attached Files Attached Files
    Last edited by loh_patrick; 06-07-2009 at 05:36 AM. Reason: Add attachment and change description

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: dynamic sumif function

    Here's one of many ways, this way uses your INDIRECT() approach.
    Attached Files Attached Files
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    06-01-2009
    Location
    Selangor, Malaysia
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: dynamic sumif function

    Hi JBeaucaire

    I don't think that the formula sheet you sent me is workable for me. My problem is more complicated than that.

    I have attached a mock copy of my file to illustrate the complexity of the file and what I'm trying to do.

    Appreciate your effort trying to solve this.

    Cheers
    Patrick
    Attached Files Attached Files

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: dynamic sumif function

    What's the answer supposed to be and where did you collate your answer from?

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: dynamic sumif function

    NVM, I see what you're doing.

    Name range - G28:DA28 = CostOfSales
    Name range - G4:DA4 = Names

    Summary report - H30: =INDEX(CostOfSales,MATCH(H21,Names,0))-SUM(H27:H29)

  6. #6
    Registered User
    Join Date
    06-01-2009
    Location
    Selangor, Malaysia
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: dynamic sumif function

    OMG!!! YOU'RE A GENIUS!!!

    Thank you so much for the formula. It was so simple.

    But for future reference, is there a way I can use a formula to return the same result?? Say if I have more than 1 P&L item which has the same name other than "SC/Others" (E.g. SC/Others and Other COS). If I replace "Other COS" for items in cell C24:C27 in the "Curr.Mth.Actual" worksheet, I wouldn't be able to use your formula for this. It would be great if you can let me know if you know of a formula that I could use for that.

    Thanks a million again JBeaucaire!!!!!!

    Cheers
    Patrick

  7. #7
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: dynamic sumif function

    You'll have to mockup your actual need when it occurs and post it up as a new question.

+ 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