+ Reply to Thread
Results 1 to 10 of 10

sum certain cells when the value is greater than zero

  1. #1
    Registered User
    Join Date
    01-22-2013
    Location
    mexico
    MS-Off Ver
    Excel 2003
    Posts
    4

    sum certain cells when the value is greater than zero

    I have numeric values from columns A1 to E1 and I want to sum just the cells A1,C1,E1 and only the values that are greater than zero

    A1 B1 C1 D1 E1
    10 5 -5 20 10

    The result should be 20 in this example

    Any suggestions????
    Last edited by chapysvp; 01-22-2013 at 02:58 PM.

  2. #2
    Forum Expert Kevin UK's Avatar
    Join Date
    12-07-2010
    Location
    Radstock, Somerset
    MS-Off Ver
    365
    Posts
    1,922

    Re: sum certain cells when the value is greater than zero

    Hi chapysvp

    You could use SUMIF:

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


    Merged Cells (They are the work of the devil!!!)

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,094

    Re: sum certain cells when the value is greater than zero

    If you have three cells with 10, -15 and 10 and you choose to ignore negative numbers, how do you get an anser of 10?

    What is in the other cells? How do you choose which cells to sum? Is it always the same three cells? Or others?


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Registered User
    Join Date
    01-22-2013
    Location
    mexico
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: sum certain cells when the value is greater than zero

    Im sorry I made a huge mistake, the values are in the columns not in the rows, a1,b1,c1,d1,e1, how to sum the values in a1,c1,e1 and only the ones on that cells that are greater than zero

  5. #5
    Forum Expert Kevin UK's Avatar
    Join Date
    12-07-2010
    Location
    Radstock, Somerset
    MS-Off Ver
    365
    Posts
    1,922

    Re: sum certain cells when the value is greater than zero

    =sumif(a1:e1,">0")

  6. #6
    Registered User
    Join Date
    01-22-2013
    Location
    mexico
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: sum certain cells when the value is greater than zero

    Hi

    I tried your formula but that sum the cells b1 and d1 too, i just want a1, c1, and e1, is that possible?

  7. #7
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: sum certain cells when the value is greater than zero

    To best describe or illustrate your problem you would be better off attaching a dummy workbook. The workbook should contain the same structure and some dummy data of the same type as the type you have in your real workbook - so, if a cell contains numbers & letters in this format abc-123 then that should be reflected in the dummy workbook.

    To attach a file to your post,
    click advanced (next to quick post),
    scroll down until you see "manage file",
    click that and select "add files" (top right corner).
    click "select files" find your file, click "open" click "upload" click 'done" bottom right. click "submit reply"

    Once the upload is completed the file name will appear below the input boxes in this window.
    You can then close the window to return to the new post screen.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

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

    Re: sum certain cells when the value is greater than zero

    Try one of these...

    If you will never insert new columns before the range:

    =SUMPRODUCT(--(MOD(COLUMN(A1:E1),2)=1),--(A1:E1>0),A1:E1)

    If you might insert new columns before the range:

    =SUMPRODUCT(--(MOD(COLUMN(A1:E1)-COLUMN(A1),2)=0),--(A1:E1>0),A1:E1)
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  9. #9
    Registered User
    Join Date
    01-22-2013
    Location
    mexico
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: sum certain cells when the value is greater than zero

    Thank you Tony

    That worked great

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

    Re: sum certain cells when the value is greater than zero

    You're welcome. Thanks for the feedback!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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