+ Reply to Thread
Results 1 to 12 of 12

Tricky Number Extraction from String

  1. #1
    Registered User
    Join Date
    07-28-2013
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    6

    Tricky Number Extraction from String

    Hello all,

    I'm trying to compute the area (Length x Width) contained in a cell.

    In a column, I have strings that contain length and width in the following way:

    Please Login or Register  to view this content.
    The cells contain: Feet.1/12inch x Feet.1/2inch

    A single cell may contain multiple items, delimited with a "," (comma)

    How can I parse this cell to calculate the area, even if there are multiple items in one cell?

    The attached workbook explains the problem well.

    Any suggestions greatly appreciated. If necessary, I can break separate items up into multiple columns. It's like this is to keep data entry as simple as possible, but amendments can be made. Thank you for your time.

    Edit: Fixed workbook
    Attached Files Attached Files
    Last edited by Oswold; 02-04-2020 at 03:43 PM.

  2. #2
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Tricky Number Extraction from String

    Hello Oswold. Welcome to the forum.

    Your attachment flags as "Invalid". Sometimes these things happen here. I've notified Admin. In the meantime please try to upload another copy again.
    Dave

  3. #3
    Registered User
    Join Date
    07-28-2013
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    6

    Re: Tricky Number Extraction from String

    Thank you, Flame. Should be fixed now.

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Tricky Number Extraction from String

    Here's one UDF that will do it

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  5. #5
    Registered User
    Join Date
    07-28-2013
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    6

    Re: Tricky Number Extraction from String

    Richard, man that's great. Thank you! I'm going to work on turning your solution into a formula. I want to try to avoid VB now for the user's sake.

    Marking as solved. Will post here later how it's done for posterity. I think I will have to break items up into separate columns if not using VB.

  6. #6
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Tricky Number Extraction from String

    Yes, it's perfecty doable with functions. You'll certainly need (or at least it will be preferable) to use helper columns if only for readability.

  7. #7
    Registered User
    Join Date
    07-28-2013
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    6

    Re: Tricky Number Extraction from String

    Richard's solution inspired me to nearly work this out formulaically. Though I think his VB function is the way to go... Here's where I'm banging my head against a wall:

    I'm having trouble parsing the decimals consistently. I've boiled it down for the need to do this:

    Please Login or Register  to view this content.
    Attached Files Attached Files

  8. #8
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Tricky Number Extraction from String

    I've also been working on a formula approach most of this afternoon and am getting stuck on the decimals, too. I thought I had it licked with DOLLARDE, but the variable decimal places foils my efforts.

  9. #9
    Registered User
    Join Date
    07-28-2013
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    6

    Re: Tricky Number Extraction from String

    Seems deceptively simple, doesn't it? It's bugging me now just out of personal satisfaction of problem solving it... That said, Richard's function is the best tool for the job. Doesn't make sense to avoid VB functions, so I've implemented it.

    If a formulaic solution hits me, I will post it here for posterity.

    Thank you both.

  10. #10
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Tricky Number Extraction from String

    Got a formula. It isn't pretty. The VBA approach wins.

    I had to "double-parse" this.

    Clear out @ 14 columns for this.

    In D3 down and across to @ J6 this parses each operation at the commas.
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Then in L3:R6 this parses the decimals and adds the fractions.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    07-28-2013
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    6

    Re: Tricky Number Extraction from String

    Job well done! Bravo. Talking about pulling a rabbit out of the hat with Excel. Lol. Impressive work. Frankly, I'm blown away by your ability to parse with those functions like that.

    My nested ifs still can't catch the corner cases like your crafted formulas. There's a lot to learn from this...

    Thank you, Flame

  12. #12
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Tricky Number Extraction from String

    You are welcome. Glad to help and glad to hear you are eager to learn.

    Thank you for the feedback, added rep and marking your thread Solved.
    Last edited by FlameRetired; 02-04-2020 at 08:31 PM.

+ 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. Tricky text string extraction
    By iantix in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 06-12-2018, 11:57 AM
  2. Date extraction from string (not standard is+number answer)
    By Sc0tt1e in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 10-12-2017, 10:13 AM
  3. Replies: 1
    Last Post: 08-07-2015, 04:01 PM
  4. Number Extraction from String
    By quibilty in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-22-2015, 03:10 PM
  5. [SOLVED] String extraction
    By pytheus in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-17-2014, 07:19 PM
  6. String Extraction
    By qcity in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 10-27-2011, 10:58 PM
  7. Tricky Extraction Problem
    By Spreadsheet in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-11-2006, 03:22 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