+ Reply to Thread
Results 1 to 3 of 3

Issues with CountIf and the value of 0...

  1. #1
    Registered User
    Join Date
    07-25-2016
    Location
    Anderson, SC
    MS-Off Ver
    MOP Plus 2010
    Posts
    1

    Issues with CountIf and the value of 0...

    Here is my enigma...
    I have cells that contain a "0". They test TRUE as Text, and FALSE as a number, yet every variation I have tried with a CountIf (or countifs) function does not test as expected. In the text posted below, the 'formula' listed in column 2 is also in Column 3 with the value returned.
    I tried formatting the cells holding the values as GENERAL, TEXT, and NUMBER (noted in each column). Those cells containing TEXT do not evaluate as expected for the "Not Equal To" text of <>. Any one else have this issue and resolve it? I am using Excel in Microsoft Office Professional Plus 2010, running version 14.0.7015.1000

    In EXCEL the first two sets of formulas have a value of 0 that is left justified and have the green box in the upper left corner to show they are 'text'. In the second two sets, the values are numeric values of 0.
    I tried to attach an image below to show that.


    CountIf with 0.jpg

    Format
    General Function Value Returned
    0 =ISTEXT($A3) TRUE
    0 =ISNUMBER($A4) FALSE
    0 =COUNTIF($A5,"'=0") 1
    0 =COUNTIF($A6,"<>0") 1
    0 =COUNTIF($A7,"'="&"0") 1
    0 =COUNTIF($A8,"<>"&0) 1
    0 =COUNTIF($A9,"<>"&"0") 1
    0 =LEN($A10) 1

    Text Function Value Returned
    0 =ISTEXT($A3) TRUE
    0 =ISNUMBER($A4) FALSE
    0 =COUNTIF($A5,"'=0") 1
    0 =COUNTIF($A6,"<>0") 1
    0 =COUNTIF($A7,"'="&"0") 1
    0 =COUNTIF($A8,"<>"&0) 1
    0 =COUNTIF($A9,"<>"&"0") 1
    0 =LEN($A10) 1

    General Function Value Returned
    0 =ISTEXT($A3) FALSE
    0 =ISNUMBER($A4) TRUE
    0 =COUNTIF($A5,"'=0") 1
    0 =COUNTIF($A6,"<>0") 0
    0 =COUNTIF($A7,"'="&"0") 1
    0 =COUNTIF($A8,"<>"&0) 0
    0 =COUNTIF($A9,"<>"&"0") 0
    0 =LEN($A10) 1

    Number Function Value Returned
    0 =ISTEXT($A3) FALSE
    0 =ISNUMBER($A4) TRUE
    0 =COUNTIF($A5,"'=0") 1
    0 =COUNTIF($A6,"<>0") 0
    0 =COUNTIF($A7,"'="&"0") 1
    0 =COUNTIF($A8,"<>"&0) 0
    0 =COUNTIF($A9,"<>"&"0") 0
    0 =LEN($A10) 1

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

    Re: Issues with CountIf and the value of 0...

    The COUNTIF function evaluates TEXT numbers and numeric numbers as being equal.

    To COUNTIF "10" and 10 are the same!

    If you need to explicitly distinguish the difference use the SUMPRODUCT function.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Valued Forum Contributor
    Join Date
    10-15-2007
    Location
    Home
    MS-Off Ver
    Office 2010, W10
    Posts
    373

    Re: Issues with CountIf and the value of 0...

    Quote Originally Posted by tfpearce View Post
    I have cells that contain a "0". They test TRUE as Text, and FALSE as a number, yet every variation I have tried with a CountIf (or countifs) function does not test as expected.
    Hi

    Like Biff said, COUNTIF() will evaluate TEXT numbers and numeric numbers as being equal.

    If you use COUNTIFS(), however, you can add the test to count just text or number values

    For ex., to count "0" (text value)

    =COUNTIFS(A:A,0,A;A,"*")

    and to count 0 (number value)

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

+ 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] COUNTIF issues??
    By Bryony309 in forum Excel Formulas & Functions
    Replies: 17
    Last Post: 07-21-2016, 09:33 AM
  2. SUMPRODUCT or COUNTIF issues
    By reidos2800 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-25-2013, 05:14 PM
  3. [SOLVED] Issues with a Countif
    By Cmorgan in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 08-19-2013, 04:52 AM
  4. COUNTIF issues
    By dannyshezo in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 12-14-2011, 05:00 PM
  5. Excel 2007 : Countif issues
    By dannyshezo in forum Excel General
    Replies: 2
    Last Post: 11-03-2011, 01:17 PM
  6. Excel 2007 : COUNTIF issues + Another question
    By systemcell in forum Excel General
    Replies: 5
    Last Post: 12-27-2009, 08:19 AM
  7. CountIF function issues
    By daniel benzie in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-28-2009, 04:56 PM

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