+ Reply to Thread
Results 1 to 19 of 19

How to use COUNTIF to count the number of cells with null strings ""

  1. #1
    Forum Contributor
    Join Date
    06-18-2012
    Location
    London
    MS-Off Ver
    Excel 2019
    Posts
    347

    How to use COUNTIF to count the number of cells with null strings ""

    I have a column and i want to count how many cells have null strings ""

    I tried to do it like: =COUNTIF($A:$A,""), but not working.

    Can you help me please?

  2. #2
    Registered User
    Join Date
    08-28-2012
    Location
    Sri Lanka
    MS-Off Ver
    Excel 2010
    Posts
    57

    Re: How to use COUNTIF to count the number of cells with null strings ""

    HI

    NOTHING WRONG WITH YOUR FOMULA.
    However I herewith attached sample. try it on your computer & let me know the result.
    Attached Files Attached Files

  3. #3
    Forum Contributor
    Join Date
    06-18-2012
    Location
    London
    MS-Off Ver
    Excel 2019
    Posts
    347

    Re: How to use COUNTIF to count the number of cells with null strings ""

    Quote Originally Posted by prashantha View Post
    HI

    NOTHING WRONG WITH YOUR FOMULA.
    However I herewith attached sample. try it on your computer & let me know the result.
    Is there anyway that I don't specify the row numbers and instead use the generic column name like $A:$A. Simply, the objective is to:

    1) count the number of cells in a column which have null strings ""
    2) use the generic column name $A:$A, without having to specify the row numbers like $A1:$A100.

  4. #4
    Forum Contributor
    Join Date
    06-18-2012
    Location
    London
    MS-Off Ver
    Excel 2019
    Posts
    347

    Re: How to use COUNTIF to count the number of cells with null strings ""

    Anyone can offer a solution for post #3?

  5. #5
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,453

    Re: How to use COUNTIF to count the number of cells with null strings ""

    Have you opened post#2 example? Your answer is there !

  6. #6
    Forum Contributor
    Join Date
    06-18-2012
    Location
    London
    MS-Off Ver
    Excel 2019
    Posts
    347

    Re: How to use COUNTIF to count the number of cells with null strings ""

    Quote Originally Posted by Pepe Le Mokko View Post
    Have you opened post#2 example? Your answer is there !
    Hi, Pepe, the formula =COUNTIF($A:$A,"") is not very useful, as it also counts those null strings as well as all blank cells! I only want those cells with null strings "".

  7. #7
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: How to use COUNTIF to count the number of cells with null strings ""

    Try this formula

    =COUNTBLANK(A:A)+COUNTA(A:A)-ROWS(A:A)
    Audere est facere

  8. #8
    Forum Contributor
    Join Date
    06-18-2012
    Location
    London
    MS-Off Ver
    Excel 2019
    Posts
    347

    Re: How to use COUNTIF to count the number of cells with null strings ""

    Quote Originally Posted by daddylonglegs View Post
    Try this formula

    =COUNTBLANK(A:A)+COUNTA(A:A)-ROWS(A:A)
    This worked! Thanks a lot!

  9. #9
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    Office 2021
    Posts
    2,237

    Re: How to use COUNTIF to count the number of cells with null strings ""

    An alternate one,

    =SUM(COUNTIF(A:A,{"<>","?*","<9E300"})*{1,-1,-1})
    Regards,
    Haseeb Avarakkan

    __________________________________
    "Feedback is the breakfast of champions"

  10. #10
    Forum Expert Colin Legg's Avatar
    Join Date
    03-30-2008
    Location
    UK
    MS-Off Ver
    365
    Posts
    1,256

    Re: How to use COUNTIF to count the number of cells with null strings ""

    Another alternate one:

    =COUNTIF(A:A,"=")
    Hope that helps,

    Colin

    RAD Excel Blog

  11. #11
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    Office 2021
    Posts
    2,237

    Re: How to use COUNTIF to count the number of cells with null strings ""

    Quote Originally Posted by Colin Legg View Post
    ...=COUNTIF(A:A,"=")
    Colin,

    I don't think so this does work

    A1: 1
    A2: A
    A3: =""

    with your formula I got 1048573 (in Excel 2007). But it must be 1. Or am I miss something?

  12. #12
    Forum Expert Colin Legg's Avatar
    Join Date
    03-30-2008
    Location
    UK
    MS-Off Ver
    365
    Posts
    1,256

    Re: How to use COUNTIF to count the number of cells with null strings ""

    You're right, should've tested it before posting! Thanks for picking it up.

  13. #13
    Forum Expert Colin Legg's Avatar
    Join Date
    03-30-2008
    Location
    UK
    MS-Off Ver
    365
    Posts
    1,256

    Re: How to use COUNTIF to count the number of cells with null strings ""

    Is

    =SUM(COUNTIF(A:A,{"=",""})*{-1,1})

    any better?

  14. #14
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    Office 2021
    Posts
    2,237

    Re: How to use COUNTIF to count the number of cells with null strings ""

    Quote Originally Posted by Colin Legg View Post
    ...=SUM(COUNTIF(A:A,{"=",""})*{-1,1})...
    Looks like working.

  15. #15
    Forum Expert Colin Legg's Avatar
    Join Date
    03-30-2008
    Location
    UK
    MS-Off Ver
    365
    Posts
    1,256

    Re: How to use COUNTIF to count the number of cells with null strings ""

    Looks like working.
    Cool.

    A1: =NA()
    A2: =NA()
    A3: =NA()

    With your formula I get 3.

  16. #16
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    Office 2021
    Posts
    2,237

    Re: How to use COUNTIF to count the number of cells with null strings ""

    Quote Originally Posted by Colin Legg View Post
    Cool.

    A1: =NA()
    A2: =NA()
    A3: =NA()

    With your formula I get 3.
    Yes Colin. I just found that error & I was coming to reply

    @All, Sorry for the inconvenience.

  17. #17
    Forum Expert Colin Legg's Avatar
    Join Date
    03-30-2008
    Location
    UK
    MS-Off Ver
    365
    Posts
    1,256

    Re: How to use COUNTIF to count the number of cells with null strings ""

    No inconvenience at all - you were a great help straightening up my dodgy attempt.

  18. #18
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: How to use COUNTIF to count the number of cells with null strings ""

    Quote Originally Posted by Colin Legg View Post
    =SUM(COUNTIF(A:A,{"=",""})*{-1,1})
    Hey, Colin! Yeah, I like that one......

    Quote Originally Posted by Haseeb A View Post
    =SUM(COUNTIF(A:A,{"<>","?*","<9E300"})*{1,-1,-1})
    Hello Haseeb, this one will also count logical values like TRUE and FALSE

  19. #19
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    Office 2021
    Posts
    2,237

    Re: How to use COUNTIF to count the number of cells with null strings ""

    Hello DLL, thank you for that info.

+ 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