+ Reply to Thread
Results 1 to 11 of 11

Reverse my current Match function

  1. #1
    Registered User
    Join Date
    01-25-2016
    Location
    New York, NY
    MS-Off Ver
    2010
    Posts
    1

    Reverse my current Match function

    Hey guys and gals,

    So I have two ranges of data. I would like to search one range (the long text string) for the numbers listed (OAN, column B), and then if they exist in the long text string, return the row number of the long text string they exist in (and eventually the actual substring itself).

    The function I currently have does the opposite. I have attached a picture and the current code.

    Please Login or Register  to view this content.
    Attached Images Attached Images

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,831

    Re: Reverse my current Match function

    A picture is not much use, as many contributors cannot view .png files on this forum due to software incompatibilities (and besides, they can't be edited to try out different formulae). Attach a sample Excel workbook instead (the FAQ describes how to).

    Pete

  3. #3
    Registered User
    Join Date
    02-09-2016
    Location
    NY
    MS-Off Ver
    2010
    Posts
    5

    Re: Reverse my current Match function

    For some reason my account was not allowing me to reply to the thread. I have created a new account to post the sample workbook.
    Last edited by sonic1019; 02-10-2016 at 11:35 AM.

  4. #4
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Reverse my current Match function

    Try

    =LOOKUP(2^15,SEARCH($B$2:$B$12,A19),$B$2:$B$12)

    Notes:
    There cannot be any blanks in B2:B12
    If there are multiple occurrences of values from B2:B12 within A19, it will return the one that appears last in B2:B12

  5. #5
    Registered User
    Join Date
    02-09-2016
    Location
    NY
    MS-Off Ver
    2010
    Posts
    5

    Re: Reverse my current Match function

    Thanks for the reply!

    But that formula returns the string that I am looking for, rather than the row number of the string it was found in (A19:A24)

  6. #6
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Reverse my current Match function

    Isn't that what you wanted?

    Quote Originally Posted by sdp1019 View Post
    (and eventually the actual substring itself).

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

    Re: Reverse my current Match function

    Not that substring, first I want to get the row number of A19:A24 that matches my B2:B12 criteria. Then I will pull out the "RISK CLAIM #" and put that next to each value B2:B12.

    It would look like this at the end, hopefully. Notice how some of the OAN numbers have the same Risk Claim #, this is what is making it difficult.
    Last edited by sonic1019; 02-10-2016 at 11:35 AM.

  8. #8
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Reverse my current Match function

    Formula in column E will give the row #s.

    But if the ultimate goal is the substrings as you put them in C2:C12
    Then the formula in column F will do that without the use of those row #s.

    SampleExcelForum-3.xlsx

  9. #9
    Registered User
    Join Date
    02-09-2016
    Location
    NY
    MS-Off Ver
    2010
    Posts
    5

    Re: Reverse my current Match function

    Thank you so much Jonmo1!

    Incredible formula by the way, I am trying to wrap my head around it right now and it is quite the task.

    One more question for you, how would I modify the function to find other bits and pieces of the string? ie DATE OF LOSS, REPORT DATE, LOSS STATE, etc

  10. #10
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Reverse my current Match function

    You're welcome.

    This is the meat of the formula
    LOOKUP(2,1/ISNUMBER(SEARCH(B2,$A$19:$A$24)),$A$19:$A$24)

    That returns the whole string from A19:A24 based on matching the value from B.

    The rest is just a bunch of string manipulation using replace, left, Trim and Substitute.

    The 51 was hardcoded based on the string always beginning with the same 51 character string.

  11. #11
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Reverse my current Match function

    If you want to get all the substrings...

    I would recommend putting the basic formula (the lookup I showed in last post) in a column.
    Copy that column, and paste as values.

    Then do Data - Text To Columns
    Deliminated - Next
    Other - *, check "treat consecutive delimiters as one" - Finish.

+ 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] Reverse strings udf function to reverse numbers
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-07-2015, 07:03 AM
  2. [SOLVED] Stuck on Match function with #N/A; attempting to reverse Index/Match
    By Cappytano in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 12-10-2014, 06:39 PM
  3. Reverse Partial match lookup
    By Stueymac in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-05-2013, 05:12 AM
  4. Reverse Index and Match functions
    By tsanodze in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-03-2013, 04:06 AM
  5. [SOLVED] INEX and MATCH reverse order
    By Tmian in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-11-2012, 01:47 PM
  6. Replies: 3
    Last Post: 06-18-2007, 03:33 AM
  7. [SOLVED] Reverse MATCH Function
    By BillCPA in forum Excel General
    Replies: 2
    Last Post: 03-08-2005, 11:06 PM

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