+ Reply to Thread
Results 1 to 6 of 6

Extract a Number from the Middle of a String with Variable # of Words

  1. #1
    Registered User
    Join Date
    08-02-2022
    Location
    Montclair, NJ
    MS-Off Ver
    MS 365
    Posts
    32

    Extract a Number from the Middle of a String with Variable # of Words

    Hello,

    I'm looking to Extract a Number from the Middle of a String with a Variable # of Words.

    The number I need is the number that's before either of the following words that may apprear in the string....
    "Bar Silver"
    "Bar Platinum"
    "Coin Silver"
    "Coin Gold"
    "Certified Coin Gold"
    "Bar Gold"

    This is a formula that I have been trying to work with, and I'm able to extract everything to Left of the number that I want, but not able to isolate the number itself.
    =TEXTBEFORE(A4,{"Bar Silver","Bar Platinum","Coin Silver","Coin Gold","Certified Coin Gold","Bar Gold"})

    The first 4 numbers that I'm looking to extract are....
    82
    5
    4
    10


    It doesn't need to be using this formula.


    Any help would be highly appreciated.

    Thank you!
    Robert

  2. #2
    Forum Expert
    Join Date
    10-11-2021
    Location
    Netherlands
    MS-Off Ver
    365
    Posts
    1,386

    Re: Extract a Number from the Middle of a String with Variable # of Words

    Try an extra textafter on a space, with instance number as -1

  3. #3
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,435

    Re: Extract a Number from the Middle of a String with Variable # of Words

    Please add manualy in your workbook some expected results in stead of a not correct working formula.

  4. #4
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,435

    Re: Extract a Number from the Middle of a String with Variable # of Words

    JEC's suggestion almost works well.
    Oddly enough, the instance number should be -2 instead of -1.

    In addition, Certified Coin Sliver also appeared to occur. I have also added this to the formula.

    Please try
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    08-02-2022
    Location
    Montclair, NJ
    MS-Off Ver
    MS 365
    Posts
    32

    Re: Extract a Number from the Middle of a String with Variable # of Words

    Thank you so much!!!!

  6. #6
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,435

    Re: Extract a Number from the Middle of a String with Variable # of Words

    You are Welcome!
    Thanks for the feedback and rep . Glad to have helped.

+ 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. [SOLVED] Extracting the first, middle and last words in a string / sentence
    By smart_beta in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 07-06-2021, 04:23 AM
  2. [SOLVED] Extract a variable length number from within a text string
    By Kirk3737 in forum Excel General
    Replies: 2
    Last Post: 10-27-2020, 02:27 PM
  3. Extract string of text in the middle of 2 delimiters
    By MoldyBread in forum Excel General
    Replies: 3
    Last Post: 05-07-2018, 07:21 AM
  4. Function to extract variable length names from middle of cell
    By ajhat in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-23-2014, 11:33 AM
  5. Extract text from the middle of a string for concatenation
    By christopherp in forum Excel General
    Replies: 1
    Last Post: 05-16-2011, 08:55 AM
  6. Extract 1, 2 or 3 words from middle of text in a cell
    By Vinnie Chan in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 08-31-2010, 02:55 PM
  7. RexEx to extract from middle or end of string
    By RobynC in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-09-2008, 12:14 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