+ Reply to Thread
Results 1 to 7 of 7

Extract Data based on a Partial Match

  1. #1
    Forum Contributor
    Join Date
    02-08-2005
    MS-Off Ver
    Microsoft 365
    Posts
    810

    Extract Data based on a Partial Match

    Hi,

    In column A in the attached workbook I have list of Product Code.

    I would like to create a formula in column B that will return the Alternative Code from column D.

    The rule for this it that if the first two characters of the Product Code are "AB" or "AC", the formula should return the Alternative Code that ends with the same 6 digits.

    In my example, "AB123456" starts with "AB" so an Alternative Code that ends with 123456 should be returned, "GG123456" in this case.

    Can someone please suggest a formula to accomplish this?

    Thanks!
    Attached Files Attached Files

  2. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Extract Data based on a Partial Match

    Maybe this is an option

    =INDEX($D$2:$D$3,MATCH(RIGHT(A2,6),RIGHT($D$2:$D$3,6),0))

    IMPORTANT
    • This is an array formula
    • Enter the formula >> press F2 then >> CTRL + SHIFT + ENTER
    • If entered correctly, the formula will be enclosed in {brackets}
    • Do not enter the {brackets} manually
    HTH
    Regards, Jeff

  3. #3
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,430

    Re: Extract Data based on a Partial Match

    One possible way,

    =IF(OR(UPPER(LEFT(A2,2))="AC",UPPER(LEFT(A2,2))="AB"),INDEX($D$2:$D$3,MATCH("*" & RIGHT(A2,6),$D$2:$D$3,0)),A2)
    Cheers
    Andy
    www.andypope.info

  4. #4
    Forum Contributor
    Join Date
    02-08-2005
    MS-Off Ver
    Microsoft 365
    Posts
    810

    Re: Extract Data based on a Partial Match

    Hi,

    A little twist on this:

    Is it possible to adjust Andy's formula to accommodate the situation where the range $D$2:$D$3 could be found in all, not all or none of Sheet1, Sheet2, Sheet3 and Sheet4. The formula would consider the range in each of these 4 sheets and return an Alternative Code when a match is made in one of the 4 sheets?

    Thanks!

  5. #5
    Forum Contributor
    Join Date
    02-08-2005
    MS-Off Ver
    Microsoft 365
    Posts
    810

    Re: Extract Data based on a Partial Match

    Thanks very much, Andy & Jeff!

  6. #6
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,430

    Re: Extract Data based on a Partial Match

    You would need to build a nested formula in order to test 4 different ranges.

    It would be easier to build a single table from the 4 separate ranges

  7. #7
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,452

    Re: Extract Data based on a Partial Match

    Hi Andrewc,
    Andy's hard code "AB" & "AC"
    A little twist with Jeff's to be non-array formula:

    Please Login or Register  to view this content.
    Enter only.
    Quang PT

+ 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: 04-02-2019, 12:22 PM
  2. [SOLVED] Filter and extract list of data based on criteria using INDEX MATCH
    By brake in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 03-13-2018, 08:30 AM
  3. [SOLVED] VLOOKUP based on partial match
    By MetroBOS in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-03-2017, 11:58 AM
  4. find data based on partial match
    By mikoski in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-08-2015, 08:47 AM
  5. Replies: 0
    Last Post: 09-21-2013, 09:03 PM
  6. Replies: 3
    Last Post: 07-10-2013, 01:39 PM
  7. sumif based on partial match
    By [email protected] in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-03-2006, 08:20 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