+ Reply to Thread
Results 1 to 3 of 3

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

  1. #1
    Forum Contributor
    Join Date
    11-10-2011
    Location
    New York, NY
    MS-Off Ver
    MS Office: Excel 365
    Posts
    163

    =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 Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    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.
    Where there is a will there are many ways.

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

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

  3. #3
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    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.

    -This is my Greek whisper to Europe.

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

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

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

+ 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.6.0 RC 1