+ Reply to Thread
Results 1 to 7 of 7

Need an Advance Sorting code/VBA.

  1. #1
    Registered User
    Join Date
    03-13-2014
    Location
    Vietnam
    MS-Off Ver
    Excel 2007
    Posts
    25

    Need an Advance Sorting code/VBA.

    Hi Guys,
    My data has about 500 rows from Column I to R (total 10 columns).
    The data in row N & O are duplicated.. And row O data can be Self-Duplicated
    Now I need to sort:
    I
    1
    9
    15

    J
    APPLE
    Sony
    Samsung

    K
    Each
    Set
    Set

    L
    Stock
    Stock
    Stock

    M
    AB
    AC
    DA

    N
    375-9323
    384-803
    790-3268

    O
    375-9323

    384-803
    375-9323
    790-3268
    P
    2
    15
    6
    8
    10
    Q
    pсs.
    pсs.
    pсs.
    pсs.
    pсs.
    R
    A
    NO
    D
    D
    D

    1. If data in Column N = Column O (Duplicate), Move all data from "Columns I J K L M N" to that row.
    2. If data in Column O is Self-Duplicated. Then copy & Move all data from "Columns I J K L M N" to that row.
    3. If data in Column O is empty or contains something that doesn't exist on Column N. Then all data from "Columns I J K L M N" should be empty.

    Results should be like this:
    I
    1

    9
    1
    15
    J
    APPLE

    Sony
    APPLE
    Samsung
    K
    Each

    Set
    Each
    Set
    L
    Stock

    Stock
    Stock
    Stock
    M
    AB

    AC
    AB
    DA
    N
    375-9323

    384-803
    375-9323
    790-3268


    O
    375-9323

    384-803
    375-9323
    790-3268
    P
    2
    15
    6
    8
    10
    Q
    pсs.
    pсs.
    pсs.
    pсs.
    pсs.
    R
    A
    NO
    D
    D
    D

    Honestly speaking, I've spent this whole weekend for this but I'm getting no where as I don't have much VBA background and My head has been hurting trying to solve this.
    So, I'm wondering If someone here is kind enough to write an example coding/VBA for this.

    Thanks guys,
    Last edited by nobodyNZ; 03-16-2014 at 01:10 PM.

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,863

    Re: Need an Advance Sorting code/VBA.

    Of course it can be done with macro, but with such data I think you could use MATCH function to locate value from O column in column N
    and then INDEX to return values from columns I:M
    Have you considered using formula too?
    Best Regards,

    Kaper

  3. #3
    Registered User
    Join Date
    03-13-2014
    Location
    Vietnam
    MS-Off Ver
    Excel 2007
    Posts
    25

    Re: Need an Advance Sorting code/VBA.

    Hi there,
    I'm currently using the below VBA coding which is working fine for less than 200 rows. However, when applying it to 500+ rows the PC takes very long time to process (8-10mins) and quite often it get stucked.
    So I think there must be a better coding than this. Thanks for your advice on the INDEX & MATCH Function. I've been looking up threads & posts to understand how these works seperately & in combination. But it will take quite a lot of time as I don't have much VBA background. Just started to do VBA coding for less than a week. So, I would appreciate any helps from the Experts.
    Thanks Guys,

    Please Login or Register  to view this content.
    Last edited by nobodyNZ; 03-16-2014 at 09:37 PM.

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Need an Advance Sorting code/VBA.

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  5. #5
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Need an Advance Sorting code/VBA.

    Hi nobodyNZ,
    Could you please attach a sample file in which your code works for 8-10 minutes

  6. #6
    Registered User
    Join Date
    03-13-2014
    Location
    Vietnam
    MS-Off Ver
    Excel 2007
    Posts
    25

    Re: Need an Advance Sorting code/VBA.

    Hi Guys,
    Problem has been solved with Function Index.Match.Match.
    Thanks for your advices !!

  7. #7
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Need an Advance Sorting code/VBA.

    Hi nobododyNZ,

    Glad you got it - but I wrote this so you may as well have it:

    Please Login or Register  to view this content.
    BTW: - You should mark this thread solved.
    Last edited by xladept; 03-17-2014 at 05:07 PM.

+ 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] Conditional sorting and make a list using advance filter
    By mukeshbaviskar in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-12-2013, 12:31 PM
  2. Need Excel Sorting Help - Thanks in Advance
    By bmiguy in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-17-2013, 10:26 PM
  3. VBA code need for advance filter non blank cells, paste data to another sheet
    By krjoshi in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-08-2012, 12:15 PM
  4. Advance Code or macro
    By yobi4ever in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-09-2007, 09:28 PM
  5. Code to Advance filter a list in a shared workbook
    By ram in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-09-2006, 10:50 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