+ Reply to Thread
Results 1 to 7 of 7

Macro to sort raw data, remove duplicates and paste 2 specific data on a different sheet

  1. #1
    Registered User
    Join Date
    04-16-2015
    Location
    India
    MS-Off Ver
    2007
    Posts
    57

    Macro to sort raw data, remove duplicates and paste 2 specific data on a different sheet

    Hello,

    Requesting all excel experts for their assistance.

    Cross posted -

    http://forum.chandoo.org/threads/mac...7/#post-158477

    The macro was created with a dummy raw data. It worked perfectly.

    Now, the problem is, the code doesn't seem to work with actual raw data.

    The code -

    Please Login or Register  to view this content.
    How the code works -

    Raw data is pasted in column R in sheet2.

    On sheet1 in cell D2 a row number is inserted. This row number tells the macro from where the raw data in sheet2 needs to be copied from.

    Keyword min and max is entered in raw data on sheet2. Keyword max tells the macro till where the raw data needs to be copied.

    Let's say, row number entered is 20 and keyword max is on row number 77. Macro copies raw data from cell 20 till cell 76. It will not copy cell number containing the keyword max.

    This data is then pasted in column A cell 5 in sheet1, where, macro sorts the data, removes duplicates and splits 2 specific data which are pasted in 2 columns F and G in sheet2 (More precisely from F2 and G2). Keyword min is removed when the sorting is done.

    Few things to note -

    1) Duplicates are removed based on 6 digit code
    2) 2 specific data that needs to separated after sorting raw data are (refer snapshot)
    • 6 digit code
    • numbers that comes immediately before all the names

    I have attached sample sheet with the code

    Note -

    Sheet2 has dummy raw data based on which the code was developed. Run the macro from sheet1 to get an idea about the end result.

    I have included actual raw data on sheet3. I want the macro to work on actual raw data.

    Any assistance will be greatly appreciated.
    Attached Images Attached Images
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    07-11-2012
    Location
    india
    MS-Off Ver
    Excel 2010
    Posts
    144

    Re: Macro to sort raw data, remove duplicates and paste 2 specific data on a different she

    Hi bimmy80,

    Move your original raw data on Sheet 3 Column B to Column R and also insert a "******************* max ************************" at the middle your code.

    based on Max your code is working so u forget in original raw data. and your code is designed to run in Column R
    Ravikumar,

    * Please Add Reputation if solved.

  3. #3
    Registered User
    Join Date
    04-16-2015
    Location
    India
    MS-Off Ver
    2007
    Posts
    57

    Re: Macro to sort raw data, remove duplicates and paste 2 specific data on a different she

    Hi fshbet,

    Thanks for responding.

    As stated earlier, I have tried running the macro with actual data on sheet2 in column R with keyword max inserted. It does not work.

    I wanted the experts whoever is working on the code to get an idea how the code works. For this purpose dummy data is pasted in sheet2. (I hope you have run the macro with the dummy data)

    I request you to run the macro by pasting actual data from sheet3 with keyword max inserted. You will notice the problem what I'm facing in column F and G.

    I have a basic idea how the macro should split the 2 specific strings after sorting (Hope my below explanation makes sense)

    (After the data is sorted out)

    All the numbers that needs to be splitted comes after a space. Macro should look for first available space in the data and then split the numbers. (Refer snapshot)

    Some numbers have a * before them. Macro should include the special character when the splitting is done. This can be viewed in the actual data on sheet3

    Since all the 6 digit codes comes after "/". Macro should look for 6 digit code after "/" and split them. (Refer snapshot)

    After this macro should remove duplicates based on 6 digit code and then paste the data in F and G column in sheet2 (I prefer the data is pasted from F2 and G2 onwards). Option should be provided in the code to change these columns.

    Below is how the end result will look like (G column should be centrally aligned)

    F Column G Column
    7loper *01
    rtol78 01
    7lrgpt 02
    Last edited by bimmy80; 11-23-2015 at 04:48 AM.

  4. #4
    Forum Contributor
    Join Date
    07-11-2012
    Location
    india
    MS-Off Ver
    Excel 2010
    Posts
    144

    Re: Macro to sort raw data, remove duplicates and paste 2 specific data on a different she

    Hi bimmy,

    Check the modified file in attachment. i think this is your expectation. Please paste the new data in Sheet 3 R Column.

    Rbkg1 (Autosaved).xlsb

  5. #5
    Registered User
    Join Date
    04-16-2015
    Location
    India
    MS-Off Ver
    2007
    Posts
    57

    Re: Macro to sort raw data, remove duplicates and paste 2 specific data on a different she

    Hi fshbet,

    I ran the macro and there are just 2 minor problems -

    1) It pastes 5 digit code instead of 6 digit code. Request you to tweak the code so that it pastes 6 digit code as in the snapshot.

    2) I would like the data in G column to be centrally aligned.

    Except for the above 2 points , macro does everything else PERFECT.

  6. #6
    Forum Contributor
    Join Date
    07-11-2012
    Location
    india
    MS-Off Ver
    Excel 2010
    Posts
    144

    Re: Macro to sort raw data, remove duplicates and paste 2 specific data on a different she

    Hi bimmy80,

    Please check the updated file below

    Rbkg1.xlsb

  7. #7
    Registered User
    Join Date
    04-16-2015
    Location
    India
    MS-Off Ver
    2007
    Posts
    57

    Re: Macro to sort raw data, remove duplicates and paste 2 specific data on a different she

    Hi fshbet,

    Exactly what I'm looking for.

    Thank you for your PATIENCE and TIME...

+ 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] Macro to remove specific data on a sheet
    By Consty1 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-01-2013, 06:22 AM
  2. [SOLVED] Remove duplicates and sort data for populating a combobox using VBA
    By newbi004 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-26-2013, 05:28 AM
  3. Copy Data, Remove Duplicates & Sort Ascending
    By DrifterX in forum Excel General
    Replies: 0
    Last Post: 04-07-2013, 05:44 PM
  4. Macro that would Copy/Paste to new sheet and remove duplicates
    By dani_n88 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 12-11-2012, 06:04 PM
  5. [SOLVED] Macro to sort and paste data in specific cells
    By planbms in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 07-12-2012, 07:39 PM
  6. Copy Data, Remove Duplicates & Sort Ascending
    By knightcloud in forum Excel General
    Replies: 1
    Last Post: 09-09-2010, 12:28 PM
  7. Macro to sort data,match,copy paste on to other sheet
    By Benjamin2008 in forum Excel General
    Replies: 1
    Last Post: 12-08-2009, 07:56 AM
  8. Trying to run a macro to sort and remove duplicates from entire sheet
    By sgmiller in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-31-2009, 10:24 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