+ Reply to Thread
Results 1 to 9 of 9
  1. #1
    Registered User
    Join Date
    05-14-2009
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    2

    Help with sumif()

    Please can someone help me with the following?
    I'm trying to work out the sum of data in column E based when column B of the row = 1 and so on.
    I thought I could do this with a lookup or sumif, but I've tried for two days to find something.
    The best I could come up with (to show I have at least tried) was to create extra columns outside of the table I'm working with and use if functions to check wether column B = 1 or not then summing up that column, but it's very messy.

    eg:
    in G2
    =IF($B2=1,$E2,"")

    Then
    =sum(G1:G10)

    Can anyone suggest anything better please?
    Thanks in advance,

    Tom

  2. #2
    Forum Guru sweep's Avatar
    Join Date
    04-03-2007
    Location
    Location: Location:
    MS-Off Ver
    XL2003 / 2007
    Posts
    2,447

    Re: Help with sumif()

    Hi,

    Try

    =SUMPRODUCT((B1:B10=1)*(G1:G10))
    Sarcasm - because beating the **** out of someone is illegal.

  3. #3
    Forum Moderator NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003, 2007, 2010
    Posts
    31,083

    Re: Help with sumif()

    Your post does not comply with Rule 5 of our Forum RULES. We have Seven question forums: Miscellaneous, General, Programming, Worksheet Functions, Charting, Excel 2007 Help and New Users. Please choose the appropriate forum, and post your question in ONLY one forum.

    Moved to Excel Worksheet Functions forum
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

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

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

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  4. #4
    Registered User
    Join Date
    05-14-2009
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Help with sumif()

    Bingo!
    Thanks so much! You've REALLY helped me out!
    I've never used SUMPRODUCT() before either.
    Cheers,

    Tom

  5. #5
    Forum Moderator DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Suffolk, UK
    MS-Off Ver
    2002, 2007 & 2010
    Posts
    21,379

    Re: Help with sumif()

    I think a standard SUMIF should suffice, no ?

    =SUMIF(B1:B10,1,E1:E10)

    SUMPRODUCTS generally only required if you have 2+ tests (and run pre XL2007) and/or are obliged to manipulate the datasets without use of helper cells.
    Last edited by DonkeyOte; 05-14-2009 at 12:20 PM.

  6. #6
    Forum Guru sweep's Avatar
    Join Date
    04-03-2007
    Location
    Location: Location:
    MS-Off Ver
    XL2003 / 2007
    Posts
    2,447

    Re: Help with sumif()

    Indeed it would.

    I appear to be suffering with sumproduct blindness.

  7. #7
    Forum Moderator NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003, 2007, 2010
    Posts
    31,083

    Re: Help with sumif()

    DonkeyOte...

    Do you mean: SUMPRODUCTS generally only required if you have 2+ tests?
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

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

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

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  8. #8
    Forum Moderator DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Suffolk, UK
    MS-Off Ver
    2002, 2007 & 2010
    Posts
    21,379

    Re: Help with sumif()

    sweep, SUMPRODUCT is my favourite function (how sad that I have a favourite!) but I;ve learnt the hard way to use in moderation and only when necessary ;-)

    NBVC, yep - I meant 2+ ... to avoid confusion have edited the post ... thanks !

  9. #9
    Forum Guru sweep's Avatar
    Join Date
    04-03-2007
    Location
    Location: Location:
    MS-Off Ver
    XL2003 / 2007
    Posts
    2,447

    Re: Help with sumif()

    It's also recently become my favourite. I used to love OFFSET, but you made me realise it's a naughty function.

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.2.0