+ Reply to Thread
Results 1 to 5 of 5

Text to Column with Text & Varying-length Numbers

  1. #1
    Registered User
    Join Date
    09-12-2011
    Location
    Washington DC
    MS-Off Ver
    Excel 2003
    Posts
    2

    Post Text to Column with Text & Varying-length Numbers

    I am trying to separate a string into two columns, however, the string contains text and numbers and it does not have an easy deliminator.

    Here is an example of the string data:
    Antioxidant Rich Fruit Blends. 6 months and up4.00 oz
    4.22 oz
    10.00 oz
    Snap on lid 3.5 oz - 2 pack7.00 oz
    No artificial flavors. Microwavable.45.00 oz

    This is what I'm trying to get it to look like:
    Please Login or Register  to view this content.
    The only consistent aspect is the "oz" at the end, however, as you can see sometimes "oz" appears in the middle of the string.

    I have tried LEFT/RIGHT/Mid, however, since the numbers I want in column B vary in length from 4 characters to 6, LEFT/RIGHT/MID ends up cutting something wrong.

    Thanks for your help!
    Last edited by vtshipe; 09-12-2011 at 05:49 PM.

  2. #2
    Registered User
    Join Date
    09-12-2011
    Location
    Washington DC
    MS-Off Ver
    Excel 2003
    Posts
    2

    Talking Re: Text to Column with Text & Varying-length Numbers

    After giving this problem a little space, I was able to figure out a solution.

    Please Login or Register  to view this content.
    The key to this problem is figuring out where to tell the MID function to start. So, the MIN(FIND function finds the first occurrence of a number 1 through 9, but instead of starting to look for numbers at the beginning of the cell we find the last "oz" and back up 8 characters.

    I hope this helps someone.
    Last edited by vtshipe; 09-13-2011 at 12:21 AM. Reason: added the "0." to the FIND so it'd pickup on decimals (0.24).

  3. #3
    Forum Contributor stevebriz's Avatar
    Join Date
    09-07-2006
    Location
    Santiago Chile
    Posts
    389

    Re: Text to Column with Text & Varying-length Numbers

    Hi you can try this and see if it works for you.

    Please Login or Register  to view this content.
    VBA - The Power Behind the Grid

    Posting a sample of your workbook makes it easier to look at the Issue.

  4. #4
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,710

    Re: Text to Column with Text & Varying-length Numbers

    Select the First cell containing data and run macro "TxtToCol" below.Pl convey your result.
    Thanks in advance.


    Please Login or Register  to view this content.
    Last edited by kvsrinivasamurthy; 09-13-2011 at 07:36 AM.

  5. #5
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,104

    Re: Text to Column with Text & Varying-length Numbers

    Another way:
    Attached Files Attached Files
    Never use Merged Cells in Excel

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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