+ Reply to Thread
Results 1 to 3 of 3

Parse text for numeric

Hybrid View

AlanF51MS Parse text for numeric 09-05-2012, 06:13 PM
jeffreybrown Re: Parse text for numeric 09-05-2012, 06:37 PM
xLJer Re: Parse text for numeric 09-05-2012, 07:40 PM
  1. #1
    Registered User
    Join Date
    05-23-2012
    Location
    Central Valley, CA
    MS-Off Ver
    Office 2010
    Posts
    14

    Parse text for numeric

    I have a column that is entered as feet in the format 4 x 4 x 8
    The customer has asked for me to provide that data in inches. Is there a simple way to use left, right and mid where instead on left number of characters it was find the x and go back from that point, ie the first x is at char 3 so I would want left 3-2, mid would be between the x x -2 and right would be the last x plus number of characters fo the end?

    Thanks
    Alan

  2. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Parse text for numeric

    Have you tried text to columns?
    HTH
    Regards, Jeff

  3. #3
    Forum Contributor
    Join Date
    07-27-2012
    Location
    California, USA
    MS-Off Ver
    Excel 2003
    Posts
    198

    Re: Parse text for numeric

    This macro will do the calculations for you.
    Data begins in cell A1 and must be in the format
    you provided, i.e. "4 x 4 x 8". Results are put in
    columns B, C & D.
    Sub Macro1()
    Dim MeasurmentsInFeet
    Dim j As Integer, k As Integer
    
        j = 1
        With Sheets("Sheet1")
            Do While .Cells(j, 1).Value <> ""
                MeasurmentsInFeet = Split(.Cells(j, 1).Value, "x")
                For k = 0 To UBound(MeasurmentsInFeet)
                    .Cells(j, k + 2).Value = CInt(MeasurmentsInFeet(k)) * 12
                Next
            
                Set MeasurmentsInFeet = Nothing
        
                j = j + 1
            Loop
        End With
        
    End Sub

+ 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