+ Reply to Thread
Results 1 to 8 of 8

SUM IF by reference

  1. #1
    Registered User
    Join Date
    12-10-2009
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    41

    SUM IF by reference

    in the attached spreadsheet I need to produce the sums in I21 & I22 by reference to G21 & G22. using these numbers I need to look up all account numbers in F13:F18 and sum all matching account numbers.

    e.g. Cash should = 10,000 + 1,000,000 + 0 + 100,000 + 0
    AR should = 2,900,000

    Any help would be appreciated
    Attached Files Attached Files

  2. #2
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: SUM IF by reference

    based on your data sample and data sorted by account number in ascending order:

    I21 = =SUMPRODUCT(--($E$13:$E$18=G21),$D$2:$D$7)

    copy down to I22

  3. #3
    Registered User
    Join Date
    12-10-2009
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    41

    Re: SUM IF by reference

    Unfortunately the account numbers associated to the BS heading will not be continuous and I will not be able to sort the data based on column A.

  4. #4
    Registered User
    Join Date
    12-10-2009
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    41

    Re: SUM IF by reference

    Is anyone else able to help?

  5. #5
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: SUM IF by reference

    Will the Account ID's in Column F be sorted ascendingly?

    =SUMPRODUCT(--(LOOKUP($A$2:$A$7,$F$13:$F$18,$E$13:$E$18)=G21),$D$2:$D$7)

    or if you can't sort ascendingly.... try:

    =SUM(IF(ISNUMBER(MATCH($A$2:$A$7,IF($E$13:$E$18=G21,$F$13:$F$18),0)),$D$2:$D$7))

    confirmed with CTRL+SHIFT+ENTER
    not just ENTER and copy down.
    Last edited by NBVC; 06-24-2010 at 04:00 PM. Reason: Added non-ascending formula option.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  6. #6
    Registered User
    Join Date
    12-10-2009
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    41

    Re: SUM IF by reference

    Hi NBVC,

    Unfortunately I cannot rely on column F being sorted.

    I tried your

    =SUM(IF(ISNUMBER(MATCH($A$2:$A$7,IF($E$13:$E$18=G21,$F$13:$F$18),0)),$D$2:$D$7))

    suggestion, but this evaluated to zero.

  7. #7
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: SUM IF by reference

    insert a new column in your data table A1 to D7 and populate it with the BS Heading value. Then summing by BS Heading is a breeze.

    If you can not sort by either column A or column F, then you will need to establish some other means of getting your results. A helper column will do the trick.

    Looking at your sample data, I wonder why column F is in the same order as column A. It also has the exact same amount of duplicates in the same order. Maybe your data will lend itself to a regular formula but if the relationship between E and F can not be mapped to A, you're on thin ice.

    cheers

  8. #8
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: SUM IF by reference

    After you enter my formula in, you need to hold the CTRL and SHIFT keys down and then hit ENTER. You will see { } brackets appear around the formula.

    Then you can copy it down.

    See attached
    Attached Files Attached Files

+ 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