+ Reply to Thread
Results 1 to 21 of 21

Using Countifs to ONLY COUNT numbers NOT FORMULAS

  1. #1
    Registered User
    Join Date
    05-06-2011
    Location
    Dawsonville, Ga
    MS-Off Ver
    Excel 2013
    Posts
    11

    Using Countifs to ONLY COUNT numbers NOT FORMULAS

    I have been trying for an hour to figure out how to get a formula that counts only if the cell contains a number. I don't want it to count a cell if it contains text or a formula. If it counts a cell that contains text, it counts a descriptive header that I don't need want counted. If it counts a cell that contains a formula, it double counts something. Is it possible to do this? If needed I can post the many, many failed formulae that I have tried to make this work.


    As you can see, I only want to count the people that have a positive number in column C. If I count C7 I count Joey Joe Joe twice. If I count C1, I count something that I don't want counted!

    Thanks in advance.
    Attached Images Attached Images

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,411

    Re: Using Countifs to ONLY COUNT numbers NOT FORMULAS

    Do you mean COUNT or SUM? You might like to look at COUNTIF or SUMIF, i.e.:

    =SUMIF(A:A,"Joey Joe Joe",C:C)

    Hope this helps.

    Pete

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

    Re: Using Countifs to ONLY COUNT numbers NOT FORMULAS

    Can't tell what you're wanting to count.

    The COUNT(...) function counts numbers only.

    Data Range
    A
    1
    23
    2
    text
    3
    #N/A
    4
    FALSE
    5
    63


    =COUNT(A1:A5) = 2
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  4. #4
    Registered User
    Join Date
    05-06-2011
    Location
    Dawsonville, Ga
    MS-Off Ver
    Excel 2013
    Posts
    11

    Re: Using Countifs to ONLY COUNT numbers NOT FORMULAS

    First off, thanks for the quick response! I should've been more clear and I'm sorry about that. The actual spreadsheet I use is much bigger than this and contains lots of names. I only want to count the names that have a positive number in the C column next to their name. In the example below, I wouldn't want Chalmers or Skinner counted because they have no numbers next to their names.
    Does this make sense?

    In the example below, I want to count two people: Joey Joe Joe and Jr. Shabadoo because those people have a positive value next to their names in column C.
    Attached Images Attached Images
    Last edited by nightdawg; 05-17-2016 at 11:00 AM.

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

    Re: Using Countifs to ONLY COUNT numbers NOT FORMULAS

    What about the cells that start with Total? Should they be counted?

  6. #6
    Registered User
    Join Date
    05-06-2011
    Location
    Dawsonville, Ga
    MS-Off Ver
    Excel 2013
    Posts
    11

    Re: Using Countifs to ONLY COUNT numbers NOT FORMULAS

    No. I only want to get a count of people that have a positive number in the C column. If I count the cells that start with total, I will get a double count.

  7. #7
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,411

    Re: Using Countifs to ONLY COUNT numbers NOT FORMULAS

    Try this:

    =COUNTIFS(A:A,"< >Total*",C:C,">0")

    I assume from your screen shots that you are NOT using XL2003 - please update your profile.

    Hope this helps.

    Pete

  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: Using Countifs to ONLY COUNT numbers NOT FORMULAS

    Maybe this...

    =SUMPRODUCT(--ISERR(SEARCH("Total",A1:A25)),--(C1:C25>0))

  9. #9
    Registered User
    Join Date
    05-06-2011
    Location
    Dawsonville, Ga
    MS-Off Ver
    Excel 2013
    Posts
    11

    Re: Using Countifs to ONLY COUNT numbers NOT FORMULAS

    I put another copy of what I am trying to do below. In the example below, I don't want to count Chalmers and Skinner, but I do want to count Jebidiah, Joey and Jr. The count I am looking for is 3 because those 3 people have positive numbers in the c column.
    Attached Images Attached Images

  10. #10
    Registered User
    Join Date
    05-06-2011
    Location
    Dawsonville, Ga
    MS-Off Ver
    Excel 2013
    Posts
    11

    Re: Using Countifs to ONLY COUNT numbers NOT FORMULAS

    I cut and pasted that formula and got 0. Did I do it wrong? And I will update my profile now.
    Attached Images Attached Images

  11. #11
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,411

    Re: Using Countifs to ONLY COUNT numbers NOT FORMULAS

    The numbers in column C are aligned to the left in your screen shots, but the normal alignment for numbers is to the right - could they be text values that just look like numbers?

    Pete

  12. #12
    Registered User
    Join Date
    05-06-2011
    Location
    Dawsonville, Ga
    MS-Off Ver
    Excel 2013
    Posts
    11

    Re: Using Countifs to ONLY COUNT numbers NOT FORMULAS

    I tried that formula and got 0. Did I enter it right?
    Attached Images Attached Images

  13. #13
    Registered User
    Join Date
    05-06-2011
    Location
    Dawsonville, Ga
    MS-Off Ver
    Excel 2013
    Posts
    11

    Re: Using Countifs to ONLY COUNT numbers NOT FORMULAS

    I made sure they were numbers and didn't get a different answer.
    Attached Images Attached Images

  14. #14
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,411

    Re: Using Countifs to ONLY COUNT numbers NOT FORMULAS

    Also, in both cases (posts #10 and #12), you should ensure that the formula is placed in a cell which is outside the ranges used in the formula (in my case, I assumed that you would put it somewhere in column D, or to the right of that).

    Pete

  15. #15
    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: Using Countifs to ONLY COUNT numbers NOT FORMULAS

    There seems to be a lot of guessing what your data looks like

    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

  16. #16
    Registered User
    Join Date
    05-06-2011
    Location
    Dawsonville, Ga
    MS-Off Ver
    Excel 2013
    Posts
    11

    Re: Using Countifs to ONLY COUNT numbers NOT FORMULAS

    Good call on putting the cells outside of the range of my formula. I put it outside the range for #12 and it counted all the cells that had a value in it and the cells that contained a formula. I'm getting closer, because this time I got a six, but I'm still not able to get the number I'm looking for.
    Attached Images Attached Images

  17. #17
    Registered User
    Join Date
    05-06-2011
    Location
    Dawsonville, Ga
    MS-Off Ver
    Excel 2013
    Posts
    11

    Re: Using Countifs to ONLY COUNT numbers NOT FORMULAS

    Thanks for that tip. Here's the workbook
    Attached Files Attached Files

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

    Re: Using Countifs to ONLY COUNT numbers NOT FORMULAS

    If the result you expect is 3...

    =SUMPRODUCT(--ISERR(SEARCH("Total",A1:A20)),--ISNUMBER(C1:C20),--(C1:C20>0))

  19. #19
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,411

    Re: Using Countifs to ONLY COUNT numbers NOT FORMULAS

    Or, given that you put my formula in A20, you can amend it to this:

    =COUNTIFS(A1:A19,"<>Total*",C1:C19,">0")

    Hope this helps.

    Pete

  20. #20
    Registered User
    Join Date
    05-06-2011
    Location
    Dawsonville, Ga
    MS-Off Ver
    Excel 2013
    Posts
    11

    Re: Using Countifs to ONLY COUNT numbers NOT FORMULAS

    Y'all are great. I put both of your formulas into my spreadsheet and they both give me the same answer on my actual spreadsheet. Pete_UK, I appreciate you not calling me an idiot even though I made a pretty idiotic mistake and Tony Valko, thanks for your formula! I really think I might not have EVER figured this out.

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

    Re: Using Countifs to ONLY COUNT numbers NOT FORMULAS

    You're welcome. We appreciate the feedback!

+ 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. [SOLVED] Count numbers vs. formulas in a range
    By aquixano in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-24-2016, 11:26 PM
  2. [SOLVED] Need Help with a COUNTIFS formulas
    By davidrias in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-18-2015, 09:29 AM
  3. [SOLVED] Combining CountIfS Formulas
    By Phil Hageman in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-21-2013, 09:25 AM
  4. Formula Optimization on several Countifs formulas
    By dcgrove in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-18-2013, 02:31 PM
  5. Replies: 6
    Last Post: 12-22-2012, 05:04 PM
  6. COUNTIFS OR...multiple countifs without duplication in the numbers
    By HooligaD in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-21-2012, 09:53 AM
  7. Replies: 0
    Last Post: 12-16-2011, 09:01 AM

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