+ Reply to Thread
Results 1 to 4 of 4

Count duplicate value in previous rows

  1. #1
    Registered User
    Join Date
    08-04-2013
    Location
    Toronto
    MS-Off Ver
    Excel 2003
    Posts
    2

    Count duplicate value in previous rows

    Hi Guys,

    I know countif function will help find out duplicate values. But now I need to find a way to do something like below. So the result field will add up with value in previous rows being duplicated.

    Value Duplicate(with countif) Result
    1 0 0
    2 0 0
    2 1 1
    3 0 0
    1 0 0
    2 1 2
    4 0 0
    3 1 1
    6 0 0

    Is there anyway to make this happen?

    Thanks for the help!
    Alan

  2. #2
    Forum Contributor
    Join Date
    08-02-2013
    Location
    Wageningen, The Netherlands
    MS-Off Ver
    365
    Posts
    495

    Re: Count duplicate value in previous rows

    You want the number of times that a duplicate of a certain number is found, right?
    Just use the COUNTIF again, referring again to the first column: C1 =COUNTIF(A$1:A$10;A1)-1

    Edit: added the $-signs
    Last edited by L-Drr; 08-04-2013 at 01:55 PM.
    When I say semicolon, u say comma!

  3. #3
    Registered User
    Join Date
    08-04-2013
    Location
    Toronto
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Count duplicate value in previous rows

    Thanks L-Drr:

    I used your recommendation (=COUNTIF(A2:$A$10,A2)-1) and achieved below result. I am hoping to achieve the Desired Result shown as below. Is it possible?


    Value Result Desired Result
    1 4 0
    1 3 1
    1 2 2
    1 1 3
    2 1 0
    1 0 4
    2 0 1



    Thanks!
    Alan

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,895

    Re: Count duplicate value in previous rows

    Try this:
    =COUNTIF($A$1:A1,A1)-1

    Alan
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  5. #5
    Registered User
    Join Date
    08-04-2013
    Location
    Toronto
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Count duplicate value in previous rows

    Hi Alan,

    Thanks! it works great!

    Alan

+ 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. Highlight and count duplicate rows
    By dmc31 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-18-2012, 01:37 PM
  2. [SOLVED] Count Duplicate rows with mulitple criteria
    By kims in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-30-2012, 09:07 AM
  3. Count and remove duplicate rows
    By Efu in forum Excel General
    Replies: 5
    Last Post: 01-14-2009, 09:41 AM
  4. Replies: 3
    Last Post: 08-03-2006, 01:58 PM
  5. [SOLVED] Count on multiple values with duplicate rows
    By Carla in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-22-2005, 05:30 PM

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