+ Reply to Thread
Results 1 to 3 of 3

Thread: =countif($b$2:b2,b2)

  1. #1
    Registered User
    Join Date
    11-10-2011
    Location
    New York, NY
    MS-Off Ver
    Excel 2010
    Posts
    3

    =countif($b$2:b2,b2)

    Hi,

    I use this formula, =COUNTIF($B$2:B2,B2), to count the number of duplicates in a sorted column and it works well (the first row with the value returns a 1; if the next row has the same B value as the previous, it returns a 2; and if the 3rd row does as well, a 3...and so on). It gives me the information I need, but my supervisor is asking me to explain it to her because she hasn't seen it before and she doesn't completely trust it yet.

    The problem:
    Someone told it to me and I never asked for an explanation, I just accepted it. So I don't fully understand it either. But I can't ask her to "just accept it" like I did.
    Can someone please break down the formula for me so I can explain it to my supervisor?

    thank you,
    kb

  2. #2
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,636

    Re: =countif($b$2:b2,b2)

    The $B$2 fixes the start of the range to B2. As you copy formula down you are always counting starting from B2, and the bottom of the range increases as you copy down, so the range gets bigger by one cell as you copy down, you are therefore counting how many times the value in B of the current row you are in appears from the start B2 to the current row.

    Have a look at COUNTIF function in Excel help for details on how the function works in general.
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  3. #3
    Valued Forum Contributor Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens Greece
    MS-Off Ver
    Excel 2003
    Posts
    2,297

    Re: =countif($b$2:b2,b2)

    Hi xtinct2

    countif($b$2:b2,b2)

    Locking($) the first row of your list. This is the secret...!

    So if you see next row, the formula is:=COUNTIF($B$2:B3;B3)

    So B2 is not chances and when you drag down the formula, in every row saws you; how many times this number(in column B), appears in your list(until this row)

    Hope to helps you.
    Attached Files Attached Files
    Regards

    Fotis.

    I am proud that i am Greek.

    Just to know every one.We Greeks, we are nοt proud of our politicians. Υou?

    Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Please,mark your thread [SOLVED] if you received your answer.


    My Avadar picture, is from Athens Acropolis.
    http://www.theacropolismuseum.gr

    http://www.visitgreece.gr/

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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.2.0