+ Reply to Thread
Results 1 to 8 of 8

Quick Macro to Reformat Data into specific format

  1. #1
    Registered User
    Join Date
    10-15-2012
    Location
    Oakland, CA
    MS-Off Ver
    Excel 2010
    Posts
    43

    Quick Macro to Reformat Data into specific format

    Hi All,

    I'm incredibly new to VBA (still) and could use some help with this!

    I've attached a file that shows some data in Sheet 1 that I need to be output into Sheet 2 quickly by a macro. There will be thousands of rows of data like this, but they will be together.

    The relevant columns are A, F, and G, as they contain the data that needs to be in the output.

    The format of the output I need is in Sheet 2, with the following specifics:

    Column A - needs to be in "000#" format so if the input value is a "3", then the output needs to be "0003"
    Column B - There will be a 6 digit number from the F column in Sheet 1, that needs to be output to "####-##-##", so basically adding dashes between the numbers.

    Can anyone help me with this? I would greatly appreciate it.

    Thanks!
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,651

    Re: Quick Macro to Reformat Data into specific format

    Try this...

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    10-15-2012
    Location
    Oakland, CA
    MS-Off Ver
    Excel 2010
    Posts
    43

    Re: Quick Macro to Reformat Data into specific format

    This is great and works perfectly.

    Thank you very much for the rapid response, I greatly appreciate it. If you are in the bay area, CA I would buy you a drink.

    Quote Originally Posted by AlphaFrog View Post
    Try this...

    Please Login or Register  to view this content.

  4. #4
    Valued Forum Contributor
    Join Date
    11-15-2008
    Location
    ph
    MS-Off Ver
    2007/2010/2016
    Posts
    479

    Re: Quick Macro to Reformat Data into specific format

    Hi -

    another variation you can consider
    Please Login or Register  to view this content.
    Regards,
    Event

  5. #5
    Registered User
    Join Date
    10-15-2012
    Location
    Oakland, CA
    MS-Off Ver
    Excel 2010
    Posts
    43

    Re: Quick Macro to Reformat Data into specific format

    Hi to both - thanks for the awesome solutions!!

    I have another added request that makes it slightly more complicated.

    In some of the data, there are 2 entries for a given day. Is there any way for the macro to consolidate all of the values for a given Number (col A) and Week (col B)?

    I updated the example and highlighted the areas to show what I'm talking about.

    Thanks again for all of your assistance - it is greatly appreciated.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    10-15-2012
    Location
    Oakland, CA
    MS-Off Ver
    Excel 2010
    Posts
    43

    Re: Quick Macro to Reformat Data into specific format

    I have another question - can the macro be modified such that it only outputs the rows where column C equals a specific value (let's say 4567) AND column D equals a specific value (let's say "Cheese")?

    Thank you again!

  7. #7
    Registered User
    Join Date
    10-15-2012
    Location
    Oakland, CA
    MS-Off Ver
    Excel 2010
    Posts
    43

    Re: Quick Macro to Reformat Data into specific format

    Hi All,

    Would those 2 requests be a complex modification? Right now I can't figure out how filtering and consolidating the specific entries would work out.

  8. #8
    Valued Forum Contributor
    Join Date
    11-15-2008
    Location
    ph
    MS-Off Ver
    2007/2010/2016
    Posts
    479

    Re: Quick Macro to Reformat Data into specific format

    Hi -

    I would suggest you close this thread and start a new one with your new sample since you have already confirmed that this post had been solved.

    Regards,
    Event

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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