+ Reply to Thread
Results 1 to 7 of 7

I am struggling with sumproduct, pls help

  1. #1
    Registered User
    Join Date
    08-11-2004
    Posts
    8

    I am struggling with sumproduct, pls help

    I wonder if someone cld help me with this formula

    My current formula that works is
    =sumproduct((D10:D100)*(left(f10:f100,3)={"app","ora","cof"}))

    I want to make app, ora, cof dynamic by putting them into cells and linking that cell something like this
    =sumproduct((D10:D100)*(left(f10:f100,3)=e1:e3))

    I tried various ways to achieve this but nothing worked.

    I would be very appreciative if anyone cld guide me on how to make this working or if this is something not doable. I searched high and low on google to get this working

    Many thanks for looking

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: I am struggling with sumproduct, pls help

    =sumproduct((d10:d100)*((left(f10:f100,3)=e1)+(left(f10:f100,3)=e2)+(left(f10:f100,3)=e3)))
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Registered User
    Join Date
    08-11-2004
    Posts
    8

    Re: I am struggling with sumproduct, pls help

    Thanks Martin
    Is that the only way ?
    I have around 50 criteria as I am trying to take 20 departments and around 2000 gl codes and spreading them over 6 company profit & loss accounts.
    I was thinking there might be a better way

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

    Re: I am struggling with sumproduct, pls help

    Try this version - you can expand E1:E3 to be as large as you want

    =SUMPRODUCT(SUMIF(F10:F100,E1:E3&"*",D10:D100))
    Audere est facere

  5. #5
    Registered User
    Join Date
    08-11-2004
    Posts
    8

    Re: I am struggling with sumproduct, pls help

    Thank you very much daddyloglegs.

    I am sorry I have wasted your time

    The solution works perfectly but I have 2 criteria.

    In my ignorance I thought I will put a simple formula. The formula I am working on is
    =SUMPRODUCT(('Account Analysis'!D10:D9999)*(LEFT('Account Analysis'!F10:F9999,3)={"402","411"})*(RIGHT('Account Analysis'!I10:I9999,2)={"31","23"}))

    The solution you gave does work but I dont know how to make it work for more than one criteria.

    I am sorry. Thanks for your help

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

    Re: I am struggling with sumproduct, pls help

    OK then - the simplest way is probably to use ISNUMBER/MATCH so that would make this formula

    =SUMPRODUCT('Account Analysis'!D10:D9999,ISNUMBER(MATCH(LEFT('Account Analysis'!F10:F9999,3),{"402","411"},0))+0,ISNUMBER(MATCH(RIGHT('Account Analysis'!I10:I9999,2),{"31","23"},0))+0)

    You can now replace the two parts with curly braces, i.e. {"402","411"} and {"31","23"} with any single column/row ranges that contain the criteria, e.g.

    =SUMPRODUCT('Account Analysis'!D10:D9999,ISNUMBER(MATCH(LEFT('Account Analysis'!F10:F9999,3),E1:E50,0))+0,ISNUMBER(MATCH(RIGHT('Account Analysis'!I10:I9999,2),A1:Z1,0))+0)

    Note: that in your version the formula will only count 402/31 and 411/23 combinations and no others
    Last edited by daddylonglegs; 02-25-2013 at 08:15 AM.

  7. #7
    Registered User
    Join Date
    08-11-2004
    Posts
    8

    Re: I am struggling with sumproduct, pls help

    Thank you so much !!
    This works perfectly well
    I can't thank you enough !
    I was struggling for about 2-3 days on google to get this working.
    Have a wonderful day daddylonglegs

+ 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