+ Reply to Thread
Results 1 to 8 of 8

Extracting string with certain layout from a text

  1. #1
    Registered User
    Join Date
    02-10-2016
    Location
    Belgium
    MS-Off Ver
    2010
    Posts
    7

    Extracting string with certain layout from a text

    Hi,

    I'm trying to extract a string with the JA-A-xx-xx-xx-xxx-xxxx-x layout from a text and paste it into the column on the left.
    Is there anybody who thinks about a way to do this? The instr function perhaps?

    This is an example of text where I need to extract the string and paste it into the column on the left.

    References: - NH90335100286001A00 - NH90335100286005A00 PERFORM JA-A-33-51-01-00A-921A-A Remarks from NHI: Remove emergency exit in order to replace at ML2 the battery 4087-21-00,Time Since Manufacture (TSM)

    Thanks in advance!

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,368

    Re: Extracting string with certain layout from a text

    Hi Jacobs.ya,

    See if this formula does what you need.

    =LEFT(MID(B1,FIND("JA-A",B1),30),24)

    In the attached see example.
    Attached Files Attached Files
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    02-10-2016
    Location
    Belgium
    MS-Off Ver
    2010
    Posts
    7

    Re: Extracting string with certain layout from a text

    Marvin,

    Thank you a lot!
    It works as a charm!

    One question:
    If I have two or three times a string with the same layout, but with different numbers in the same text, how can I extract them all?

  4. #4
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,368

    Re: Extracting string with certain layout from a text

    Hi Jacobs,

    I don't understand the question. Can you attach a sample of what you have and what you want as an answer?

    To attach a sample workbook, click on "Go Advanced" and then on the Paper Clip Icon above the advanced message area.

  5. #5
    Registered User
    Join Date
    02-10-2016
    Location
    Belgium
    MS-Off Ver
    2010
    Posts
    7

    Re: Extracting string with certain layout from a text

    Marvin,

    In some of the texts, there are multiple times the same kind of string I search for, like this:

    Visual examinations References: NH90063204281011M00 NH90063204281012M00 NH90063204281013M00 Perform the tasks prescribed in following DMC's: JA-A-06-32-03-01A-310C-A, JA-A-06-32-04-01A-310B-A, JA-A-06-32-04-02A-310B-A, JA-A-06-32-04-03A-310B-A

    Your formula finds the string I searched for, but if it is in the text multiple times, I want all the strings to be copied, it that's possible?

  6. #6
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Extracting string with certain layout from a text

    With multiple sub-strings to be extracted I would suggest to change the direction: String should be let' say in Col A and formula entered in B1 and pull to the right until you see blanks

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


    v A B C D E
    1 NH90335100286001A00 - NH90335100286005A00 PERFORM JA-A-33-51-01-00A-921A-A Remarks from NHI: Remove emergency exit in order to replace at ML2 the battery 4087-21-00,Time Since Manufacture (TSM) JA-A-33-51-01-00A-921A-A
    2 NH90063204281011M00 NH90063204281012M00 NH90063204281013M00 Perform the tasks prescribed in following DMC's: JA-A-06-32-03-01A-310C-A, JA-A-06-32-04-01A-311B-A, JA-A-06-32-04-02A-312B-A, JA-A-06-32-04-03A-313B-A JA-A-06-32-03-01A-310C-A JA-A-06-32-04-01A-311B-A JA-A-06-32-04-02A-312B-A JA-A-06-32-04-03A-313B-A
    Last edited by AlKey; 02-11-2016 at 03:37 PM.
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  7. #7
    Registered User
    Join Date
    02-10-2016
    Location
    Belgium
    MS-Off Ver
    2010
    Posts
    7

    Re: Extracting string with certain layout from a text

    AlKey,

    Thanks for your time!

    I typed the formula into excel and I get an error on the A1, which I changed to D4, because that's where the column of the text's start.

  8. #8
    Registered User
    Join Date
    02-10-2016
    Location
    Belgium
    MS-Off Ver
    2010
    Posts
    7

    Re: Extracting string with certain layout from a text

    =LEFT(TRIM(MID(SUBSTITUTE(SUBSTITUTE($D4;"JA-A";"|JA-A");"|";REPT(" ";255));255*COLUMNS($D:D);255));24)

    I replaced the comma's with ; and it works!
    Attached Images Attached Images
    Last edited by Jacobs.ya; 02-12-2016 at 03:56 AM.

+ 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 text value from string
    By dchubbock in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-20-2015, 07:56 AM
  2. Extracting text from a string
    By AlexDeLara in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-26-2014, 04:41 AM
  3. Extracting numbers and text from inconsistent text/number formatted string
    By Brandivil in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-25-2013, 01:46 PM
  4. [SOLVED] Extracting Text from a string of Text & Digits of variable length
    By hastex in forum Excel General
    Replies: 6
    Last Post: 06-06-2012, 09:11 AM
  5. Extracting the last name of a string of text
    By simjambra in forum Excel General
    Replies: 7
    Last Post: 05-15-2009, 11:04 AM
  6. Extracting just the last name in a text string
    By braydon16 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-06-2008, 08:19 PM
  7. Extracting from a text string
    By AmyTaylor in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-24-2005, 08:34 AM

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