+ Reply to Thread
Results 1 to 3 of 3

Sort Column based on certain numbers

  1. #1
    Registered User
    Join Date
    12-13-2019
    Location
    Michigan, United States
    MS-Off Ver
    365
    Posts
    9

    Sort Column based on certain numbers

    I figured Id ask here before the VBA forums.

    The quick version is Im trying to move rows in a very specific manner. The first column contains numbers that are 4 digits long. If they are preceded with the number 1, I have to see if the other three digits match any of the rest of the rows. If it does, I need to drop the 4 digit number with 1 under the matching one. i.e.

    Starting sheet:
    0001 |...|...
    0002 |...|...
    0003 |...|...
    0004 |...|...
    1001 |...|...
    1002 |...|...

    Desired look:
    0001 |...|...
    1001 |...|...
    0002 |...|...
    1002 |...|...
    0003 |...|...
    0004 |...|...

    Each entry of 0001 - 0999 are unique values.

    The idea would be to check to the right of 1 for values. For example, 1999 would drop the one and then check 999 and compare it for an exact match using the remaining three characters.

    This is also in a table.

    The first XXXX only happens when theres two of the same part(number), we denote that as the opposite here.

    Thank you,
    Last edited by rendon115; 03-10-2020 at 01:47 PM.

  2. #2
    Registered User
    Join Date
    01-24-2020
    Location
    Belgium
    MS-Off Ver
    2013
    Posts
    95

    Re: Sort Column based on certain numbers

    Hi, there

    You can use VALUE(MID(A1,2,3)) to extract numbers, then sort the numbers in an ascending order.

    pls refer to the formulae in the attached file.
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    12-13-2019
    Location
    Michigan, United States
    MS-Off Ver
    365
    Posts
    9

    Re: Sort Column based on certain numbers

    This would work in theory, but the numbers in the rows are not 0001, or 0002. Theyre formatted as 4 numbers in excel, so the actual values are just 1 and 2, respectively. So in theory,
    Please Login or Register  to view this content.
    would be the idea. I dont know how to move rows around, based on a matching value in excel using formulas though.

+ 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. Replies: 8
    Last Post: 05-12-2019, 07:35 AM
  2. Replies: 5
    Last Post: 05-09-2017, 08:48 AM
  3. Sort column with row numbers
    By Raffe in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-19-2016, 05:18 PM
  4. [SOLVED] I have a sort macro. How to add script to preselect rows to sort based on column value?
    By Jasonhouse in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 03-09-2014, 02:25 AM
  5. Sequence numbers based on date and independent of column sort order
    By bedepe in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 02-21-2014, 07:32 PM
  6. Replies: 7
    Last Post: 07-24-2010, 08:07 PM
  7. [SOLVED] How do I sort numbers based on last two digits?
    By The Wallaby in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-21-2005, 06:06 PM

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