+ Reply to Thread
Results 1 to 14 of 14

Count occurrences and if zero then leave cell blank.... How???

  1. #1
    Forum Contributor
    Join Date
    08-29-2013
    Location
    CT
    MS-Off Ver
    Excel 2016 Mac
    Posts
    268

    Count occurrences and if zero then leave cell blank.... How???

    So here is my dilemma,

    I have a sheet that has a calculated cell that counts the number of occurrences a given value occurs. The formula in that cell is =COUNTIF('Grade K-8'!B1:CR570,"1,51") I want to add to it so that if the count is "0" it will return a blank cell

    I hope this is enough information, let me know if it isn't

    George

  2. #2
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Count occurrences and if zero then leave cell blank.... How???

    You pretty much have to do

    =IF(COUNTIF(...)=0,"",COUNTIF(...))

  3. #3
    Forum Contributor
    Join Date
    08-29-2013
    Location
    CT
    MS-Off Ver
    Excel 2016 Mac
    Posts
    268

    Re: Count occurrences and if zero then leave cell blank.... How???

    Thank you for the quick reply,

    I am no excel head, what would the formula look like with my formula in it. Would i just substitute the ... for what is inside my parenthesis?

  4. #4
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Count occurrences and if zero then leave cell blank.... How???

    Or a trick I recently learned...
    I'm not familiar with MAC, but if it has the IFERROR function like XL2007+ on PC,

    =IFERROR(1/(1/COUNTIF(...)),"")

  5. #5
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Count occurrences and if zero then leave cell blank.... How???

    Quote Originally Posted by Losguapos1 View Post
    Would i just substitute the ... for what is inside my parenthesis?
    That's right.

  6. #6
    Forum Contributor
    Join Date
    08-29-2013
    Location
    CT
    MS-Off Ver
    Excel 2016 Mac
    Posts
    268

    Re: Count occurrences and if zero then leave cell blank.... How???

    THANKS a million Jonmo1

  7. #7
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Count occurrences and if zero then leave cell blank.... How???

    You're welcome.

  8. #8
    Forum Contributor
    Join Date
    08-29-2013
    Location
    CT
    MS-Off Ver
    Excel 2016 Mac
    Posts
    268

    Re: Count occurrences and if zero then leave cell blank.... How???

    one more question, i now need to update a ton of formulas


    =IF(COUNTIF('Grade K-8'!B1:CR570,"1,51")=0,"",COUNTIF('Grade K-8'!B1:CR570,"1,51"))
    =IF(COUNTIF('Grade K-8'!B1:CR570,"1,51")=0,"",COUNTIF('Grade K-8'!B1:CR570,"1,51"))
    =IF(COUNTIF('Grade K-8'!B1:CR570,"1,51")=0,"",COUNTIF('Grade K-8'!B1:CR570,"1,51"))
    =IF(COUNTIF('Grade K-8'!B1:CR570,"1,51")=0,"",COUNTIF('Grade K-8'!B1:CR570,"1,51"))

    I need the red numbers to be ascending
    is there an easy way to do this without having to go into each formula and manually change?

  9. #9
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Count occurrences and if zero then leave cell blank.... How???

    Try

    =IF(COUNTIF('Grade K-8'!B$1:C$R570,ROWS(A$1:A1)&",51")=0,"",COUNTIF('Grade K-8'!B$1:CR$570,ROWS(A$1:A1)&",51"))


    However, I'd recommend putting the strings in their own cells, example...
    In B1 put
    =ROWS(A$1:A1)&",51"
    and fill down as far as needed

    Then use
    =IF(COUNTIF('Grade K-8'!B$1:C$R570,B1)=0,"",COUNTIF('Grade K-8'!B$1:CR$570,B1))
    and fill down.

  10. #10
    Forum Contributor
    Join Date
    08-29-2013
    Location
    CT
    MS-Off Ver
    Excel 2016 Mac
    Posts
    268

    Re: Count occurrences and if zero then leave cell blank.... How???

    Thank for the input but that is way over my head. I have over 600 formulas that need to be updated. I wish i knew more and could take car of it in a more efficient manner.

    What do mean by put the strings in thier own cell?

  11. #11
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Count occurrences and if zero then leave cell blank.... How???

    Take the basic countif (without the testing if it's 0)

    =COUNTIF('Grade K-8'!B1:CR570,"1,51")

    The string "1,51" can be placed in a cell so your countif formula refers to that cell instead.
    So say B1 = 1,51
    =COUNTIF('Grade K-8'!B1:CR570,B1)


    Now to make the 1 incirment to 2 to 3 as it's dragged down, that's where the ROWS() function comes in.
    =ROWS(A$1:A1) = 1
    As it's dragged down, it becomes
    =ROWS(A$1:A2) = 2
    =ROWS(A$1:A3) = 3
    etc..

    Then concatenate (join 2 strings together) with the rest of the string ",51"
    =ROWS(A$1:A1)&",51"


    Hope that helps.

  12. #12
    Forum Contributor
    Join Date
    08-29-2013
    Location
    CT
    MS-Off Ver
    Excel 2016 Mac
    Posts
    268

    Re: Count occurrences and if zero then leave cell blank.... How???

    I have added the workbook I am working on, in the teacher summary page is where I need all of those formaulsa to return a value of an empty cell if the value is "0"
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    10-23-2010
    Location
    Corpus Christi, Texas
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Count occurrences and if zero then leave cell blank.... How???

    Thank you Very Much

  14. #14
    Registered User
    Join Date
    10-23-2010
    Location
    Corpus Christi, Texas
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Count occurrences and if zero then leave cell blank.... How???

    Quote Originally Posted by Jonmo1 View Post
    Or a trick I recently learned...
    I'm not familiar with MAC, but if it has the IFERROR function like XL2007+ on PC,

    =IFERROR(1/(1/COUNTIF(...)),"")
    Thank you Very Much

+ 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] Simple pull exact text from cell, if blank it pulls up a 0. How to leave it as blank?
    By sharpmel in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-30-2012, 02:20 PM
  2. Count occurrences of any numbers within a cell
    By Jamey in forum Excel General
    Replies: 2
    Last Post: 12-15-2010, 01:01 PM
  3. Replies: 4
    Last Post: 07-15-2008, 01:42 PM
  4. Count blank rows between occurrences
    By shoey72 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-19-2008, 09:24 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