+ Reply to Thread
Results 1 to 2 of 2

keep n duplicates not just a single instance - how

Hybrid View

  1. #1
    Registered User
    Join Date
    11-13-2010
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    22

    keep n duplicates not just a single instance - how

    I have a sheet of 20k rows comprising company name/address and contact name address on the same row. Each company has between 1 to 400 contacts (rows).

    Each contact appears on a separate row and has a unique ID for the company it belongs to on that row as well as a unique ID for the contact.

    What I need to do is append a flag field for each row with LOAD or NOLOAD depending on this rule:

    For each new company (unique ID) count the rows downwards associated with that ID. When the 9th row in that group occurs place NOLOAD in a flag field and keep doing this until there are no more rows in that account group. Do the same for the next unique ID (new account) and so on.
    So I am effectively keeping 9 'duplicates' (contacts actually) of the account ID field and flagging the rest for subsequent removal (NOLOAD) that I can do with a filter later.

    Hope this is do-able and appreciate any help rendered! Using Excel 2010.

    Cheers

    DAve


    ****Thanks to NBVC for solving this - works a treat!***
    Last edited by TopDogDave; 11-13-2010 at 11:08 PM. Reason: solved

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

    Re: keep n duplicates not just a single instance - how

    It is a bit unclear if you want to start "flagging" at the 9th occurance or the 10th.

    If you want to begin at the 9th, then assuming you are starting in A2, enter this in the "flag column" at row 2:

    =IF(COUNTIF(A$2:A2,A2)>=9,"NoLoad","Load")

    If you want to begin at the 10th, then

    =IF(COUNTIF(A$2:A2,A2)>9,"NoLoad","Load")

    copied down the list
    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.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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