+ Reply to Thread
Results 1 to 12 of 12

Help to extract partial text from a cell

Hybrid View

  1. #1
    Registered User
    Join Date
    12-12-2014
    Location
    UK
    MS-Off Ver
    MS Office Professional Plus 2010
    Posts
    4

    Re: Help to extract partial text from a cell

    Abousetta - here are some logical statements about what I am searching for:
    • Multiple Sclerosis will always be spelled out in full (not abbreviated to MS)
    • The number I am looking for will always be contained within brackets after 'Multiple Sclerosis '
    • The term Multiple Sclerosis may appear anywhere in the list
    • Other items in the list vary from row to row

    Ron - thank you, that formula does work. But I'd like to understand it better. I'm not familiar with the 10^10 notation or the {1,2,3...etc}

    I've just seen other replies to my OP as well so reviewing those now

  2. #2
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Help to extract partial text from a cell

    In the formula I posted: =IFERROR(LOOKUP(10^10,--LEFT(MID(C2,SEARCH($I$1,[@[Disease Areas]])+LEN($I$1),10),{1,2,3,4,5,6,7,8})),0)

    This section: LOOKUP(10^10,--LEFT(MID(C2,SEARCH($I$1,[@[Disease Areas]])+LEN($I$1),10),{1,2,3,4,5,6,7,8}))
    takes advantage of a LOOKUP feature(?).

    Regarding an array of numbers,
    1) LOOKUP ignores any error values (#N/A!, #VALUE!, etc)
    2) If the lookup value is greater than the all of the arrayed numbers...it returns the last numeric value

    using Row_2 as an example
    Once this section: MID(C2,SEARCH($I$1,[@[Disease Areas]])+LEN($I$1),10)
    returns: "5)Stroke "

    This part: LEFT(MID(C2,SEARCH($I$1,[@[Disease Areas]])+LEN($I$1),10),{1,2,3,4,5,6,7,8})
    builds an array of the left 1, then 2, then 3, etc. characters and
    returns this array: {"5","5)","5)","5)S","5)St","5)Str","5)Stro","5)Strok"}

    and this part tries to convert each element of that array to a number: --LEFT(MID(C2,SEARCH($I$1,[@[Disease Areas]])+LEN($I$1),10),{1,2,3,4,5,6,7,8})
    resulting in this array: {5,#VALUE!,#VALUE!,#VALUE!,#VALUE!,#VALUE!,#VALUE!,#VALUE!}

    Finally, when the LOOKUP function tries to match 10^10...which is larger than any value you would expect to find...it matches on the last numeric value: 5

    If the Multiple Sclerosis text was this: Multiple Sclerosis (500)
    The resulting array would be this: {5,50,500,#VALUE!,#VALUE!,#VALUE!,#VALUE!,#VALUE!}
    so the LOOKUP match would be 500

    I hope that helps.
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

+ 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] Find Partial text in an array and extract charaters to right
    By jenita.kurlawala in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 12-02-2013, 08:03 AM
  2. [SOLVED] extract partial string from Cell
    By sydcoco in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-28-2013, 12:34 AM
  3. Extract partial content from a single cell
    By mildredtpeabody in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-21-2013, 06:39 PM
  4. matching partial text within one cell to partial text within another
    By Solstice in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 03-03-2010, 09:13 PM
  5. formula to extract partial content (text) of cell
    By milano in forum Excel General
    Replies: 3
    Last Post: 11-09-2005, 01:00 PM

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