+ Reply to Thread
Results 1 to 5 of 5

Need help in extracting substring from string

  1. #1
    Registered User
    Join Date
    01-14-2016
    Location
    Singapore
    MS-Off Ver
    2010
    Posts
    2

    Need help in extracting substring from string

    For example a column contains:

    Change to Unlock mode: SW1Cleaner2 SW1Cleaner2, Card Version: 2
    Change to Normal mode: 002858 ONG AI LING, Card Version: 1
    Invalid User: 1403754C VERNETTA LIN YONG XUAN, Card Version: 1
    Change to Normal mode: SW0001 Master Card V7, Card Version: 1
    Invalid Attempt, Time Zone Error: 005255 LEE KIM YONG, Card Version: 1
    Legal Access (Door Open Fail): 003837 FUA YING HUAY, Card Version: 1

    From the column above, I want to create another column that only have their names like:
    SW1Cleaner2
    ONG AI LING
    VERNETTA LIN YONG XUAN
    Master Card V7
    LEE KIM YONG
    FUA YING HUAY

    Can anyone help me with this? Thanks!

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,199

    Re: Need help in extracting substring from string

    Try

    =MID(SUBSTITUTE(MID(A1,FIND(":",A1),255)," ","/",2),FIND("/",SUBSTITUTE(MID(A1,FIND(":",A1),255)," ","/",2))+1,FIND(",",SUBSTITUTE(MID(A1,FIND(":",A1),255)," ","/",2))-FIND("/",SUBSTITUTE(MID(A1,FIND(":",A1),255)," ","/",2))-1)

  3. #3
    Registered User
    Join Date
    01-14-2016
    Location
    Singapore
    MS-Off Ver
    2010
    Posts
    2

    Re: Need help in extracting substring from string

    Quote Originally Posted by JohnTopley View Post
    Try

    =MID(SUBSTITUTE(MID(A1,FIND(":",A1),255)," ","/",2),FIND("/",SUBSTITUTE(MID(A1,FIND(":",A1),255)," ","/",2))+1,FIND(",",SUBSTITUTE(MID(A1,FIND(":",A1),255)," ","/",2))-FIND("/",SUBSTITUTE(MID(A1,FIND(":",A1),255)," ","/",2))-1)
    Thanks JohnTopley! You helped me big time here.

    Do you mind telling my the explanation behind the formula? I would like to learn more about it.

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,199

    Re: Need help in extracting substring from string

    Change to Unlock mode: SW1Cleaner2 SW1Cleaner2, Card Version: 2

    SUBSTITUTE(MID(A1,FIND(":",A1),255)," ","/",2), finds the second space after the first ":" and substitutes it with "/"so we get

    Change to Unlock mode: SW1Cleaner2/SW1Cleaner2, Card Version: 2

    FIND(",",SUBSTITUTE(MID(A1,FIND(":",A1),255)," ","/",2)

    This finds the position of the "," starting at the position of the "/" (the FIND formula)

    It then subtracts the Postion of the "/" from the postion of the "," to get the required text

    Change to Unlock mode: SW1Cleaner2/SW1Cleaner2, Card Version: 2

    Hope this helps.

  5. #5
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Need help in extracting substring from string

    Hi.

    Please re-read the forum rules, in particular that one related to "cross-posting".

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

+ 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: 4
    Last Post: 03-20-2014, 01:39 PM
  2. [SOLVED] Extracting a Substring Between Second and Third Delimiters
    By MrGadget6977 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-18-2013, 05:54 PM
  3. Extracting substring function VBA
    By friko16 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-27-2013, 06:04 PM
  4. [SOLVED] Copy a substring from a string
    By raul09 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-02-2013, 12:53 AM
  5. Finding a substring within a string
    By Michael D in forum Excel General
    Replies: 7
    Last Post: 02-21-2013, 04:01 PM
  6. [SOLVED] Find the position of a substring in a string
    By nemo66ro in forum Excel General
    Replies: 6
    Last Post: 10-22-2012, 01:21 AM
  7. Extracting Substring from Column of Data
    By Narmerguy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-16-2011, 10:34 PM
  8. Searching for a substring in a string
    By 1rovilla in forum Excel General
    Replies: 3
    Last Post: 05-07-2010, 08:17 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