+ Reply to Thread
Results 1 to 6 of 6

sorting rows with unique identifier and then duplicate identifier

  1. #1
    Forum Contributor
    Join Date
    05-13-2019
    Location
    Halifax, Canada
    MS-Off Ver
    2016
    Posts
    176

    sorting rows with unique identifier and then duplicate identifier

    Hi All,

    I have set of data that has unique "Code" and duplicate "Codes". I was trying to figure out the VBA code that would sort my set of data with unique identifier that is "Code" in the first order and then the duplicate identifier that is again "Code" in the second order. The separated unique and duplicate identifiers are then sorted in their dates order.

    I am attaching the test file for your ready reference.

    Pic1.PNG

    Thank you
    Roshan Shakya

    1. Sorting with unique Transaction Code.xlsx

  2. #2
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: sorting rows with unique identifier and then duplicate identifier

    If you accept to use column "E" as dummy column try next code
    Please Login or Register  to view this content.
    - Battle without fear gives no glory - Just try

  3. #3
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,151

    Re: sorting rows with unique identifier and then duplicate identifier

    Quote Originally Posted by Roshan.Shakya View Post
    ... the VBA code that ... sort ...
    1. data with unique identifier in the first order ...
    2. then the duplicate identifier ... in the second order.
    3. The separated unique and duplicate identifiers are then sorted in their dates order.
    Why a macro here ? An helper column with the formula is enough, e.g.:

    a) in 'E1' enter some headline
    b) in 'E2' enter formula and copy down:

    =IF(COUNTIF($B$2:$B$24;$B2)=1;1;2) & "-" & $B2 & $C2

    then sort.

  4. #4
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: sorting rows with unique identifier and then duplicate identifier

    Why a macro here
    Perhaps to add the helper column and delete it afterward ..!

  5. #5
    Forum Contributor
    Join Date
    05-13-2019
    Location
    Halifax, Canada
    MS-Off Ver
    2016
    Posts
    176

    Re: sorting rows with unique identifier and then duplicate identifier

    Excellent Alsace, thank you.

    Roshan Shakya

  6. #6
    Forum Contributor
    Join Date
    05-13-2019
    Location
    Halifax, Canada
    MS-Off Ver
    2016
    Posts
    176

    Re: sorting rows with unique identifier and then duplicate identifier

    Excellent Drevni,

    Thank you
    Roshan Shakya

+ 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. [SOLVED] Give Duplicate Alphanumeric Values a Unique Identifier
    By papgar in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 01-18-2018, 10:45 AM
  2. Replies: 1
    Last Post: 02-16-2017, 07:53 PM
  3. Need a formula to create a unique identifier for Duplicate names
    By asharma9 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-21-2015, 04:37 PM
  4. How to Keep only the first 4 rows to each unique identifier
    By JanettaK in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-25-2015, 03:59 PM
  5. Replies: 1
    Last Post: 01-29-2015, 04:08 PM
  6. Adding Unique Identifier to Rows of data
    By adam_w2009 in forum Excel General
    Replies: 13
    Last Post: 04-21-2013, 06:37 AM
  7. [SOLVED] Need help with merging rows by matching unique identifier.
    By lunatyck in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-31-2012, 11:59 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