+ Reply to Thread
Results 1 to 11 of 11

Sum Multiple Columns Based On Another Column

  1. #1
    Registered User
    Join Date
    08-20-2013
    Location
    Schenectady, NY
    MS-Off Ver
    Excel 2011 Mac
    Posts
    64

    Sum Multiple Columns Based On Another Column

    Hi. I am unable to create a formula which will add two columns based on criteria in another column.

    Ex:

    A.....B.....C
    .......1.....1
    .......1.....1
    NN...1.....1
    .......1.....1

    The formula =SUM(B:C) will result in 8 because it will add everything in columns B and C. The formula =SUMIF(A:A,"NN",B:B) will result in 1 because it will add column B whenever there is "NN" in column A.

    How do I add both columns B and C whenever "NN" appears in column A?

  2. #2
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Sum Multiple Columns Based On Another Column

    Do you mean?

    =SUMIF(A:A,"NN",B:B)+SUMIF(A:A,"NN",c:c)
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  3. #3
    Registered User
    Join Date
    08-20-2013
    Location
    Schenectady, NY
    MS-Off Ver
    Excel 2011 Mac
    Posts
    64

    Re: Sum Multiple Columns Based On Another Column

    Yes, I found that the formula =SUMIF(A:A,"NN",B:B)+SUMIF(A:A,"NN",C:C) will add them both. Is there a way to simplify the formula?

  4. #4
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Sum Multiple Columns Based On Another Column

    Perhaps

    =SUMPRODUCT((A1:A1000="nn")*(B1:C1000))

  5. #5
    Registered User
    Join Date
    08-20-2013
    Location
    Schenectady, NY
    MS-Off Ver
    Excel 2011 Mac
    Posts
    64

    Re: Sum Multiple Columns Based On Another Column

    That works, except that, whenever there is text in the columns to be added, the formula results in #VALUE!.

  6. #6
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Sum Multiple Columns Based On Another Column

    Then try in this way.

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

  7. #7
    Registered User
    Join Date
    08-20-2013
    Location
    Schenectady, NY
    MS-Off Ver
    Excel 2011 Mac
    Posts
    64

    Re: Sum Multiple Columns Based On Another Column

    That's okay. I've decided to stick with the SUMIF-based formula.

    Thanks for your help!

  8. #8
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Sum Multiple Columns Based On Another Column

    You are welcome and thanks for the feed back.

    As that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED,as per Forum Rule #9. Thank you.

    Also, as a new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

  9. #9
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Sum Multiple Columns Based On Another Column

    You can try this array formula**:

    =SUM(IF(A2:A10="NN",B2:C10))

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.

    You should avoid using entire columns as range references in array formulas. Use smaller specific ranges.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  10. #10
    Registered User
    Join Date
    08-20-2013
    Location
    Schenectady, NY
    MS-Off Ver
    Excel 2011 Mac
    Posts
    64

    Re: Sum Multiple Columns Based On Another Column

    Thanks for the suggestion!

  11. #11
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Sum Multiple Columns Based On Another Column

    You're welcome!

+ 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. Replies: 2
    Last Post: 07-09-2012, 01:44 PM
  2. From one long column to multiple columns based on value
    By zerospin in forum Excel General
    Replies: 0
    Last Post: 05-26-2011, 01:02 PM
  3. Indent multiple Columns based on Value in One Column
    By BEEJAY in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-15-2011, 01:42 PM
  4. Sorting Multiple Columns Based on 1 Column
    By edexcel123 in forum Excel General
    Replies: 3
    Last Post: 10-12-2010, 04:38 PM
  5. sum a column based on multiple other columns being true
    By sofia in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-07-2006, 11:10 PM

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