+ Reply to Thread
Results 1 to 6 of 6

Array sorting

  1. #1
    Registered User
    Join Date
    11-28-2017
    Location
    Sweden
    MS-Off Ver
    2016
    Posts
    21

    Smile Array sorting

    Hello.
    So i have an issue with this and i really don't see how i can get around it.

    I use a regex to get data from a PDF file. It's a order confirmation from my supplier and as such i need to check if the OC is consistent with the data in my system. I figured i'd get rid of the manual work and automatize the process. When i use the regex, the data will be inserted in an array in the same order as in the OC. My problem is that there are three variables in that OC that are not static- Sometimes that value will appear twice, and i need them both, sometimes once, and sometimes not at all-. Now AFTER this variable there are two variables that ARE static and i need them extraced in the same go to ensure they originate from the same string. Let me show you:

    Please Login or Register  to view this content.
    This is a part of the regex extraction. As you can see, sometimes the RALXXXX value (the color actually) is present twice and sometimes omitted.
    I need to get this sorted. Either by replacing the missing RAL values with something, OR reordering the array to get the second last variable (my order number) AND the last variable (my row number) first.

    Now i'm very bad at arrays so i really need some help. Perhaps there is a completely other way to solve this that i have not thought of?

    This is what i got today:
    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: Array sorting

    Hi !

    As you write results to cells, why don't ypu use Excel basics like its sort method ?

    Some before and after worksheets may help to better see your need …

  3. #3
    Registered User
    Join Date
    11-28-2017
    Location
    Sweden
    MS-Off Ver
    2016
    Posts
    21

    Re: Array sorting

    Hello Marc.
    Thanks for your quick reply.
    It's not the sorting as list im looking for, more the order of the columns. I need the code to either print the result of the submatch if it contains the "RAL" variable or skip to the next column if it doesn't - leaking a blank cell instead. This is the tricky part.. Please refer to my attachent for before and after scenario.

    It doesn't seem like its possible for me to attach files, so i'll send a image instead just to make sure that you see what i mean. ^^
    Capture.PNG

    EDIT:: I realize that i can just build a loop and evalute the results, looking for what i need and rearreange it, but it feels like fixing up the results, not addressing the real issue if you see what i mean.
    Last edited by AxiAngel; 05-23-2019 at 04:44 AM.

  4. #4
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,231

    Re: Array sorting

    Hi AxiAngel

    Difficult without a sample upload...Give this a go...
    This fixes after results are placed....
    not addressing the real issue if you see what i mean.
    Would only be able to assist with initial code if you are able to upload your file...
    Please Login or Register  to view this content.
    Last edited by sintek; 05-23-2019 at 05:57 AM.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Array sorting

    I think that would be a matter of RegX pattern to get the correct match.

  6. #6
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    365 Pro Plus
    Posts
    2,274

    Re: Array sorting

    Assumes data in Col A and Cols B-E are empty...
    Please Login or Register  to view this content.

+ 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. Sorting 2D array
    By ImranBhatti in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-27-2018, 09:51 PM
  2. Sorting an Array
    By vba_beginner in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-23-2013, 11:19 PM
  3. Sorting an array
    By lukela85 in forum Excel General
    Replies: 0
    Last Post: 02-12-2013, 04:17 PM
  4. Excel 2007 : Sorting by array
    By ncurran217 in forum Excel General
    Replies: 12
    Last Post: 12-02-2011, 12:52 PM
  5. Sorting an array
    By lukela85 in forum Excel General
    Replies: 10
    Last Post: 07-09-2010, 08:10 PM
  6. sorting an array
    By johnboy12 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-12-2008, 11:36 PM
  7. [SOLVED] Sorting an Array
    By Mike Archer in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-28-2006, 02:20 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