+ Reply to Thread
Results 1 to 5 of 5

Extract a data pattern (character combo may change but not the pattern) from a cell

  1. #1
    Registered User
    Join Date
    01-22-2020
    Location
    Bangalore
    MS-Off Ver
    Office 13
    Posts
    2

    Extract a data pattern (character combo may change but not the pattern) from a cell

    In a cell there will be large amount of data. I am looking for a macro that can identify a specific text pattern and extract and paste in a different cell.
    Pattern will be consistent
    characters in the pattern will not be consistent
    There may be space before and after the pattern begins and ends
    In some cases, there may not be space before or after

    Pattern will be like xxxxxx-xxxxxx-xxxxxx-xxxxxx
    It will be a combination of numerics and texts.

  2. #2
    Forum Expert WideBoyDixon's Avatar
    Join Date
    10-03-2016
    Location
    Sheffield, UK
    MS-Off Ver
    365
    Posts
    2,182

    Re: Extract a data pattern (character combo may change but not the pattern) from a cell

    Paste this code into a new module:

    Please Login or Register  to view this content.
    Then you can use, for example, the following formula to extract the pattern:

    Please Login or Register  to view this content.
    WBD
    Office 365 on Windows 11, looking for rep!

  3. #3
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: Extract a data pattern (character combo may change but not the pattern) from a cell

    Assuming Data in col.A, output in Col.B
    Please Login or Register  to view this content.

  4. #4
    Forum Expert WideBoyDixon's Avatar
    Join Date
    10-03-2016
    Location
    Sheffield, UK
    MS-Off Ver
    365
    Posts
    2,182

    Re: Extract a data pattern (character combo may change but not the pattern) from a cell

    Arrgh! My eyes are too old; I didn't see there were 6 x's in each group. You *could* therefore use this:

    Please Login or Register  to view this content.
    Note that this pattern *insists* that there isn't an extra matching character at the beginning/end of the matched string.

    WBD

  5. #5
    Registered User
    Join Date
    01-22-2020
    Location
    Bangalore
    MS-Off Ver
    Office 13
    Posts
    2

    Re: Extract a data pattern (character combo may change but not the pattern) from a cell

    Thank you so much Dixon. The macro did work. Thanks again.

+ 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. Extract data Using regular pattern
    By Imran/CVT in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 10-30-2019, 01:26 PM
  2. Replies: 7
    Last Post: 08-27-2019, 08:37 AM
  3. [SOLVED] How to extract data from a cell match a certain pattern and PRINT or DISPLAY the out
    By bennyys in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-24-2017, 11:48 AM
  4. [SOLVED] Lookup and return rows based on pattern start and pattern end
    By JDI in forum Excel General
    Replies: 18
    Last Post: 11-16-2014, 11:44 PM
  5. Extract data between match pattern, process in another sheet
    By 123raajesh in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-30-2014, 12:38 PM
  6. Copy down hypertext cell range pattern & cell reference formula pattern
    By Underexcelling in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-10-2014, 03:23 AM

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