+ Reply to Thread
Results 1 to 14 of 14

Adding only certain cells in a column

  1. #1
    Registered User
    Join Date
    10-20-2012
    Location
    calif
    MS-Off Ver
    Excel 2007
    Posts
    19

    Adding only certain cells in a column

    For the attached workbook, does a formula exist that would allow me to only count cells that are under particular columns in each row? For instance, at the end of a row I would like to simply count the number of "P" cells that have data entered into them. Thank you!
    Attached Files Attached Files
    Last edited by innatedoc; 10-24-2012 at 01:20 AM.

  2. #2
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Adding only certain cells in a column

    It is possible with sumif (see the attached file).

    The result is in the green cells.
    Attached Files Attached Files
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  3. #3
    Registered User
    Join Date
    10-20-2012
    Location
    calif
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Adding only certain cells in a column

    Awesome - thanks!

  4. #4
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Adding only certain cells in a column

    Glad I could help you.

    Will you mark the question as solverd?

  5. #5
    Registered User
    Join Date
    10-20-2012
    Location
    calif
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Adding only certain cells in a column

    I thought I did - sorry. I will try again. Isn't there a way to give you a star or something for helping too?

  6. #6
    Registered User
    Join Date
    10-20-2012
    Location
    calif
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Adding only certain cells in a column

    You know, upon further reflection and now that I'm home from work to play around with the workbook, the formula doesn't quite do what I was hoping to learn to do. It appears that the formula totals the numbers in the cells in the "P" columns. I am wondering if there is a way to count a "P" cell with any entry as a "1" and not count any other cells. I don't want to add the numbers in the "P" cells, I'd like to count the number of "P" cells that have data entered in them in a particular row. Is there a way to do that?

  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
    52,938

    Re: Adding only certain cells in a column

    change the sumif() formula to sumifS()

    =SUMIFS(A4:X4,A3:X3,Z3,A4:X4,1)
    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
    Registered User
    Join Date
    10-20-2012
    Location
    calif
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Adding only certain cells in a column

    thanks! i'll try that out . . .

  9. #9
    Registered User
    Join Date
    10-20-2012
    Location
    calif
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Adding only certain cells in a column

    Hmmmmm . . . there exists the distinct possibility that i am doing this wrong, but when i put that formula in it comes up with a "1" no matter how many "P" cells in the row contain data (unless no "P" cells contain data, in which case it comes up with a "0")

  10. #10
    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
    52,938

    Re: Adding only certain cells in a column

    sorry, dont know why i was thinking "add". if you want to count the P's with 1 in them, try this...

    =SUMPRODUCT((A3:X6=1)*(A3:X3=Z3))

    if you want a separate total for each row, use this...
    =COUNTIFS(A3:X3,Z3,A4:X4,1)

  11. #11
    Registered User
    Join Date
    10-20-2012
    Location
    calif
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Adding only certain cells in a column

    I think we're getting closer! I'd like to count a "P" with ANY data in it as a 1, and I need to be able to do it on each row.

    if a "P" has "$4.00" in it I'd like to count it as a 1. If it has "$0.50" in it, I'd like to count it as a one. No matter what the data is I'd like to count it as a 1, unless there is no data and then I'd like not to count it. Kind of like a binary thing - it's either a 1 or a 0 (yes or no) no matter what data the cell contains. Is that even possible?

  12. #12
    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
    52,938

    Re: Adding only certain cells in a column

    ok, i thought you only wanted to coiunt IF it had 1 in. change to this, for each row...
    =COUNTIFS($A$3:$X$3,$Z$3,A4:X4,">0")

  13. #13
    Registered User
    Join Date
    10-20-2012
    Location
    calif
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Adding only certain cells in a column

    Awesome! that worked in my test file. I'm going to attempt to adapt it to my actual workbook and see if it works. Thanks!

  14. #14
    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
    52,938

    Re: Adding only certain cells in a column

    glad to help, and thanks for the rep

+ 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