+ Reply to Thread
Results 1 to 6 of 6

Remove Blanc Space, parse text, convert text to measurement

  1. #1
    Forum Contributor
    Join Date
    03-02-2014
    Location
    usa
    MS-Off Ver
    MS 365
    Posts
    593

    Remove Blanc Space, parse text, convert text to measurement

    Hello,
    I have a cell which holds a Feet-Inch measurement such as 60’-10”.
    I am trying to come up with a formula to read the value from this cell and do the conversion to inches, like =60*12+10
    There are some complicating factors though:
    - If the cell has a value like 60’-10 Ύ”, than, I want to ignore the Ύ” or whatever fraction follows the round inch number.
    - The Feet value could be one or two digit (never more than two digits), same the Inch value (it could be 6’-1”; 6’-10”; 60’-1” and so on… any combination of these).
    - Sometimes there might me spaces before the first digit or after the last digit or anywhere between, like: _60_’_10”_ (the “_” is a space, not actual “_”).
    Complicated.. (For me)
    Could somebody advice?
    Thank you

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: Remove Blanc Space, parse text, convert text to measurement

    Lets take this a step at a time.

    1st, do your feet have a ' or a ’ (there is a difference, look closely)

    Assuming they have '...
    =LEFT(A1,FIND("'",A1,1)-1)*12+SUBSTITUTE(MID(A1,FIND("-",A1,1)+1,2),CHAR(34),"")

    Test that, and then lets see where we need to tweak it?
    If you still have a problem, upload a small (clean) sample workbook (not a pic) of what you are working with, and what your expected outcome would look like.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,728

    Re: Remove Blanc Space, parse text, convert text to measurement

    What other fractions are you likely to encounter? Please list them.

    From what you have said above you can get the feet to inches like this:

    =LEFT(A1,FIND("’",A1)-1)*12

    (NOTE that the apostrophe is not the one from the keyboard, so just copy this into the formula bar), and you can extract the inches like this:

    =SUBSTITUTE(SUBSTITUTE(MID(A1,FIND("’",A1)+1,FIND("”",A1)-FIND("’",A1)-1),"Ύ",""),"-","")+0

    So you can have this combined formula in B1:

    =LEFT(A1,FIND("’",A1)-1)*12+SUBSTITUTE(SUBSTITUTE(MID(A1,FIND("’",A1)+1,FIND("”",A1)-FIND("’",A1)-1),"Ύ",""),"-","")

    and it will cope with all the examples you have posted. (NOTE that the double quotes in your examples, the inches sign, is not the normal quotes character either).

    Hope this helps.

    Pete

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: Remove Blanc Space, parse text, convert text to measurement

    @ Pete, I see you picked up on the different indicators

  5. #5
    Forum Contributor
    Join Date
    03-02-2014
    Location
    usa
    MS-Off Ver
    MS 365
    Posts
    593

    Re: Remove Blanc Space, parse text, convert text to measurement

    Thank you both FDibbins and Pete !No need to tweak, it works perfect !

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: Remove Blanc Space, parse text, convert text to measurement

    Happy to help and thanks for the feedback

+ 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. Replies: 3
    Last Post: 06-15-2014, 11:31 AM
  2. [SOLVED] replace multiple spaces with one space to parse text
    By goodmma in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 11-20-2013, 06:21 PM
  3. Remove text between first and last space.
    By -James_ in forum Excel General
    Replies: 3
    Last Post: 10-24-2011, 12:02 PM
  4. Parse Strings of Space-Separated Text of Varying Lengths
    By mlexcelhelpforum in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-09-2011, 07:49 AM
  5. Remove Space in Text
    By Tian in forum Excel General
    Replies: 5
    Last Post: 04-06-2006, 02:15 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