+ Reply to Thread
Results 1 to 8 of 8

Extract a substring with find and mid

Hybrid View

  1. #1
    Registered User
    Join Date
    10-24-2010
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    49

    Extract a substring with find and mid

    I have searched many forums but am having trouble finding an example of exactly what I am trying to achieve.

    There are many examples to extract a substring with find and mid for a single occurrence of the string, but what if there were multiple occurrences.

    For example the string below is in cell A1 and want to extract the substrings ALEX01, ALEX02 and ALEX03 into cells A2, A3 and A4.

    ALEX01FRED01ALEX02FRED02ALEX03FRED03.

    Thank you.

  2. #2
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,879

    Re: Extract a substring with find and mid

    Here!

    Put this formula in Cell A2 and Drag Down

    =MID($A$1,(ROW(A1)*6)-5,6)

    Deep
    Cheers!
    Deep Dave

  3. #3
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,879

    Re: Extract a substring with find and mid

    I have assumed in the Above formula that the length of each entry would be 6 Characters only.

    Deep

  4. #4
    Registered User
    Join Date
    10-24-2010
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    49

    Re: Extract a substring with find and mid

    Deep,

    Sorry, a small mistake in my original post, the ouput to be in B1, C1, D1.

    Also the formula you posted extracts every 6 text strings into the cell, I want only to extract ALEX and not FRED.

    Can you still help me.

  5. #5
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,879

    Re: Extract a substring with find and mid

    Do you want to Extract Alex along with the 2 Numbers ahead of it or just Alex??

  6. #6
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,879

    Re: Extract a substring with find and mid

    Here!

    Put in in Cell B1 and Drag Across -

    =MID($A$1,(COLUMN(A1)*12)+1-12,6)

    Assumed that you need Alex with 01 & Alex & Fred would appear alternately.

    If not, then please specify further.

    Deep

  7. #7
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,710

    Re: Extract a substring with find and mid

    If data is in column A, put this formula(ARRAY FORMULA) in B1 and drag across and downwords .Pl see attached file.

    =IFERROR(MID($A1,SMALL(IF(MID($A1,ROW(INDIRECT("A1:A"&LEN($A1)-6)),4)="ALEX",ROW(INDIRECT("A1:A"&LEN($A1)-6)),""),COLUMN(A1)),6),"")
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    10-24-2010
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    49

    Re: Extract a substring with find and mid

    kvsrinivasamurthy.

    Thank you. Exactly what I wanted.

+ 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] extract from string whole word(s) containing substring
    By Bearpecs in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-24-2012, 10:37 AM
  2. [SOLVED] Extract Substring, then Ignore that Substring, while collecting data from Other substrings
    By Sameki121 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-17-2012, 05:21 PM
  3. Extract a substring with formula
    By bobwachs in forum Excel General
    Replies: 2
    Last Post: 09-10-2010, 04:47 PM
  4. Extract each substring from current cell
    By clickcoder in forum Excel General
    Replies: 6
    Last Post: 02-16-2010, 10:48 AM
  5. Extract 1st matching substring from cell
    By mtgiles in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-26-2008, 03:34 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