+ Reply to Thread
Results 1 to 5 of 5

Why is countif showing 2 for an array list

  1. #1
    Registered User
    Join Date
    09-01-2011
    Location
    Austria
    MS-Off Ver
    Excel 2007
    Posts
    78

    Why is countif showing 2 for an array list

    I have a list and if I calculate {=COUNTIF(List,List)} it'll return 2.


    list.png
    http://cdn.get-digital-help.com/wp-c...-in-excel3.xls

    I'm trying to understand what's happening; if I don't use arrays it'll return one because it compares the list to itself, on the whole. Arrays will compare cell by cell so that means that each cell should count how many times it finds itself in the list, no?

  2. #2
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,156

    Re: Why is countif showing 2 for an array list

    hi labogola. not sure what you mean when you say if you don't use arrays, it'll return one. it doesn't have any relevance here if you simply look at it as a single value. it is meant to return an array of results for the formula to work. since List refers to A2:A20, doing COUNTIF(List,List) is as though you're doing:
    =COUNTIF(List,A2)
    =COUNTIF(List,A3)
    =COUNTIF(List,A4)
    and so on until A20. so since the above results give you 2,1,1 & so on, the COUNTIF(List,List) all 19 results:
    {2;1;1;2;1;1;2;2;1;2;2;2;1;1;1;2;1;1;1}
    you can get that by selecting the formula portion & press F9 to calculate.

    the purpose of the above is to be continued with a logical test to see if they appeared more than once. so COUNTIF(List,List)<>1. since you only asked this portion, i suppose you're ok with the rest of the formulas

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  3. #3
    Registered User
    Join Date
    09-01-2011
    Location
    Austria
    MS-Off Ver
    Excel 2007
    Posts
    78

    Re: Why is countif showing 2 for an array list

    Ok I see if I just type in =countif(list,list) I get a 1. and if I press F9 I get {2;1;1;2;1;1;2;2;1;2;2;2;1;1;1;2;1;1;1}, i.e. an array of =COUNTIF(List,A2), =COUNTIF(List,A3) and so on.

    I don't get then what =countif(list,list) is doing if it's only returning 1 in a cell, and if I do it in a few cells it'll just return 1,1,0,0..0..0 etc...

    Also I'm not sure what "<>" is.. I tried googling it but couldn't find. is that smaller than or bigger than?

  4. #4
    Forum Contributor
    Join Date
    08-14-2013
    Location
    Here and there
    MS-Off Ver
    Excel 2010
    Posts
    376

    Re: Why is countif showing 2 for an array list

    "<>" means 'not equal to'

  5. #5
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Why is countif showing 2 for an array list

    Hi,

    "I don't get then what =countif(list,list) is doing if it's only returning 1 in a cell, and if I do it in a few cells it'll just return 1,1,0,0..0..0 etc..."

    Not sure what you mean here - are you trying to enter =COUNTIF(List,List) into single cells?

    When coerced to an array, COUNTIF(List,List) will produce e.g. {2;1;1;2;1;1;2;2;1;2;2;2;1;1;1;2;1;1;1}. However, that is not to say that this array will be returned from a stand-alone formula such as =COUNTIF(List,List).

    And, even when array-entered, you will not be able to 'see' the entire array contents in one cell: you would need to select as many cells as are elements in the array before committing the formula in order to see the individual elements in separate cells (or press F9 in the formula bar, though this is not quite the same thing).

    Regards
    Last edited by XOR LX; 09-07-2013 at 09:10 AM.
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

+ 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. Replies: 2
    Last Post: 03-02-2013, 04:36 PM
  2. search for a part of string within an array of strings from another array list
    By jdonohue in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-12-2011, 01:32 PM
  3. Showing each value from a list
    By Richmate in forum Excel General
    Replies: 5
    Last Post: 04-15-2010, 03:29 AM
  4. Countif showing #value error
    By dodger999 in forum Excel General
    Replies: 3
    Last Post: 09-25-2009, 05:17 PM
  5. Showing one of every value in array
    By rs56369 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-26-2008, 06:05 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