Results 1 to 17 of 17

How to Find a Matching Pattern and Retrieve Data from the Adjacent Column

Threaded View

  1. #1
    Valued Forum Contributor Saarang84's Avatar
    Join Date
    02-19-2009
    Location
    Chennai, India
    MS-Off Ver
    XL 2003 to 2010
    Posts
    812

    How to Find a Matching Pattern and Retrieve Data from the Adjacent Column

    I need some help to find and match patterns of strings in a column and fetch data from the adjacent column. I've attached a sample workbook with my sample data.

    How can I find the appropriate matching pattern and fetch and fill data from the adjacent column from my source table to destination? I tried the string functions available and used SEARCH function to match the pattern and check whether it is available. However, when the pattern is found, how can I fetch the adjacent column ?

    My attempt to code a formula using SUBSTITUTE, MID and SEARCH functions made me stumble at a Frankenstein monster
    Below is the monster formula I wrote - it works and returns 1 when the pattern is found.

    Formula: copy to clipboard
    =IF(ISERROR(SEARCH(B2,A2)),IF(OR(IF(ISERROR(SEARCH(MID(B2,1,FIND("(",B2,1)-1)&MID(MID(SUBSTITUTE(SUBSTITUTE(B2,"(","["),")","]"),FIND("[",SUBSTITUTE(SUBSTITUTE(B2,"(","["),")","]"),1),(FIND("]",SUBSTITUTE(SUBSTITUTE(B2,"(","["),")","]"),1)+1-FIND("[",SUBSTITUTE(SUBSTITUTE(B2,"(","["),")","]"),1))),2,1)&MID(B2,FIND(")",B2,1)+1,LEN(B2)),A2)>0),0,SEARCH(MID(B2,1,FIND("(",B2,1)-1)&MID(MID(SUBSTITUTE(SUBSTITUTE(B2,"(","["),")","]"),FIND("[",SUBSTITUTE(SUBSTITUTE(B2,"(","["),")","]"),1),(FIND("]",SUBSTITUTE(SUBSTITUTE(B2,"(","["),")","]"),1)+1-FIND("[",SUBSTITUTE(SUBSTITUTE(B2,"(","["),")","]"),1))),2,1)&MID(B2,FIND(")",B2,1)+1,LEN(B2)),A2)),IF(ISERROR(SEARCH(MID(B2,1,FIND("(",B2,1)-1)&MID(MID(SUBSTITUTE(SUBSTITUTE(B2,"(","["),")","]"),FIND("[",SUBSTITUTE(SUBSTITUTE(B2,"(","["),")","]"),1),(FIND("]",SUBSTITUTE(SUBSTITUTE(B2,"(","["),")","]"),1)+1-FIND("[",SUBSTITUTE(SUBSTITUTE(B2,"(","["),")","]"),1))),4,1)&MID(B2,FIND(")",B2,1)+1,LEN(B2)),A2)>0),0,SEARCH(MID(B2,1,FIND("(",B2,1)-1)&MID(MID(SUBSTITUTE(SUBSTITUTE(B2,"(","["),")","]"),FIND("[",SUBSTITUTE(SUBSTITUTE(B2,"(","["),")","]"),1),(FIND("]",SUBSTITUTE(SUBSTITUTE(B2,"(","["),")","]"),1)+1-FIND("[",SUBSTITUTE(SUBSTITUTE(B2,"(","["),")","]"),1))),4,1)&MID(B2,FIND(")",B2,1)+1,LEN(B2)),A2)))=TRUE,1,0),SEARCH(B2,A2)) 
    I need to return the matching pattern that is found. And with it the corresponding adjacent cell's value. Can anyone help me ?
    Attached Files Attached Files
    If my assistance has helped, there is a reputation icon * on the left hand corner below the post - you can show your appreciation to the user who has helped in resolving your requirement.

    If your requirement has been solved please mark your thread as Solved.
    In the menu bar above the very first post, select Thread Tools, then select "Mark this thread as Solved".

    Kindly use [FORMULA] or [CODE] tags when posting your code.

    Regards,
    Sarang

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Find matching value in one column to copy adjacent cell on same row
    By soradsauce in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-21-2020, 12:40 AM
  2. [SOLVED] Retrieve Data From Multiple Worksheets By Matching Column Headers And Row IDs
    By Ariff_Chowdhury in forum Excel Programming / VBA / Macros
    Replies: 67
    Last Post: 04-20-2014, 03:18 PM
  3. Continue a vertical pattern on an adjacent column
    By gkostrom in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-10-2014, 09:33 PM
  4. Need VBA to find matching data between worksheets & copy adjacent rows.
    By Helen62 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-16-2013, 12:19 AM
  5. [SOLVED] Globally modify non-adjacent worksheet formulas matching a pattern
    By tlafferty in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-10-2012, 02:42 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