+ Reply to Thread
Results 1 to 8 of 8

Two stage sorting function which eliminates gaps and sorts duplicate ranks?

  1. #1
    Registered User
    Join Date
    12-13-2013
    Location
    Raleigh, NC
    MS-Off Ver
    Excel 2010
    Posts
    12

    Two stage sorting function which eliminates gaps and sorts duplicate ranks?

    Hi folks. Here is my scenario I'm trying to sort with using only formulas (older external program will not read .xlsm or .xlsx). I'll spare you the details of my own hackneyed attempt but let's just say I felt I was getting close with INDEX, MATCH, FIND and VLOOKUP but hit a wall.

    Columns A and B: categories in order I need the data sorted by (non-alphabetic):
    DO = 001
    RAY = 002
    MI = 003
    FA = 004
    SO = 005
    LA = 006
    TI = 007

    Column C: Non-sorted data
    RAY01
    RAY05
    RAY03
    DO01
    FA02
    TI05

    Column D: a helper column of some kind I imagine, for example the first three digits are by finding the text in Column A and inserting corresponding number in column B, after decimal is the "rank" within each category:
    002.1
    002.3
    002.2
    001.1
    004.1
    007.1

    Column E, output data sorted according to Column D
    DO01
    RAY01
    RAY03
    RAY05
    FA02
    TI05

    Maybe I need another helper column? Maybe I'm approaching it totally wrong? The variables being different lengths, skips in the ranking, duplicate rankings, my brute force methods are not cutting it. Any insight would be great!

    Thanks in advance.
    W. Johnson

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: Two stage sorting function which eliminates gaps and sorts duplicate ranks?

    Hi wdjohnson,

    Is there a chance that a custom sort order would help with your problem?

    https://support.office.com/en-us/art...2-A06455C379E1
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    12-13-2013
    Location
    Raleigh, NC
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Two stage sorting function which eliminates gaps and sorts duplicate ranks?

    Thanks for the reply. Maybe I made the example seem too simple. A real world project may have 50+ variables (DO, RAY, MI) to sort and add to that the list may change, lengthen, shorten per project. My aim was to have the list visible and customizable by the end user. Actually, the variable list in Column A is the only input the user would need to control. The raw data is imported by a FileNameList and the output sorted column would be copied and pasted into another worksheet by the user. My goal was to have the rest automated.

  4. #4
    Registered User
    Join Date
    12-13-2013
    Location
    Raleigh, NC
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Two stage sorting function which eliminates gaps and sorts duplicate ranks?

    Thought I would attach this progress file in case anyone wanted to see the direction I was trying to go. Thanks!
    Attached Files Attached Files

  5. #5
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: Two stage sorting function which eliminates gaps and sorts duplicate ranks?

    Try these ARRAY formulas
    IN K2, then drag down
    Please Login or Register  to view this content.
    IN I2 , then drag across for I & J columns
    Please Login or Register  to view this content.
    ARRAY formula is used

    To enter ARRAY formula
    Paste the formula
    Press F2
    Press Ctrl+Shift+Enter keys together.
    formula will be covered with{} brackets.

  6. #6
    Registered User
    Join Date
    12-13-2013
    Location
    Raleigh, NC
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Two stage sorting function which eliminates gaps and sorts duplicate ranks?

    Thanks. This didn't quite get me where I needed to go but I found another route (used defined names to avoid monster formulas), creating a list with the dual ranking coded into the number 2.001, 2.002,etc. sorting and indexing. If you're curious to know specifics, reply back to this message and I'll send you an example.

    Thanks again for your help!

  7. #7
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Two stage sorting function which eliminates gaps and sorts duplicate ranks?

    Yes, please. Post an example.
    Dave

  8. #8
    Registered User
    Join Date
    12-13-2013
    Location
    Raleigh, NC
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Two stage sorting function which eliminates gaps and sorts duplicate ranks?

    See attached. Thanks everyone!

+ 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] Formula and Sorts by Ranks.
    By javijuan in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-29-2015, 10:01 AM
  2. Duplicate File Finder (Checksum project-Stage 3)
    By mc84excel in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-06-2015, 08:32 PM
  3. Macro for sorting only sorts half the data
    By mazzola.mv in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-27-2013, 02:03 PM
  4. IF function that eliminates empty rows
    By abrazee in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-03-2006, 12:29 AM
  5. [SOLVED] How do I differentiate between duplicate ranks?
    By Pez in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-26-2006, 07:15 PM
  6. sorting with RANK/VLOOKUP (problem with equal ranks)
    By hip in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-28-2006, 02:50 AM
  7. [SOLVED] DUPLICATE RANKS
    By Matthew in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 12-22-2005, 09:10 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