+ Reply to Thread
Results 1 to 4 of 4

Lookup formula to find code from part of text

  1. #1
    Registered User
    Join Date
    02-17-2011
    Location
    Denmark
    MS-Off Ver
    Excel 2003
    Posts
    10

    Lookup formula to find code from part of text

    In sheet1 I have the following sample data (column B is what I am after):
    clip.png

    The code is what I want to find, and I have done it manually in this example. In sheet2 clip2.png I have a listing of strings and associated codes. The aim is to find the code automatically, for example in sheet1!B2 the formula should identify that the string "Abon" matches with code 87.

    As there might be multiple occurrences it would be fine to stop at the first match.

    Any ideas about how to achieve this?

  2. #2
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Lookup formula to find code from part of text

    hi mlun. are you still using Excel 2003? you should change your profile for the MS-Off Ver if it has changed. that will enable us to give you newer & more efficient formulas. also, it's better if you can upload a sample excel file next time so that we don't have to re-create your data to test it out.

    if you don't mind having the last match instead of first match, then;
    =LOOKUP(2^15,SEARCH(Sheet2!$A$2:$A$5,A2),Sheet2!$B$2:$B$5)

    if you want the first match, maybe this array formula:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer. Press F2 on that cell and try again.

    change all my commas to semi-colons if your separators are supposed to be semi-colons

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  3. #3
    Registered User
    Join Date
    02-17-2011
    Location
    Denmark
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: Lookup formula to find code from part of text

    Thank you so much benishiryo!! That's really amazing, and problem solved!
    I still use this very old Excel version

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Lookup formula to find code from part of text

    Based on your last post in this thread, its apparent that you are satisfied with the solution(s) you've received and have solved your question, but you haven't marked your thread as "SOLVED". I will do it for you this time.

    In future, to mark your thread as Solved, you can do the following -
    Select Thread Tools-> Mark thread as Solved.

    Incase your issue is not solved, you can undo it as follows -
    Select Thread Tools-> Mark thread as Unsolved.

    Also, since you are relatively new to the forum, i would like to inform you that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post which helped you. This adds to the reputation of the person who has taken the time to help you.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

+ 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. Lookup for Code that Corresponds to Part of string of text in a Cell
    By brandnew22 in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 08-06-2013, 07:33 PM
  2. [SOLVED] Find Text In Range With Part Of Text & Return True or False
    By tis28 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 06-30-2013, 09:35 PM
  3. Replies: 7
    Last Post: 01-24-2013, 06:55 PM
  4. [SOLVED] Lookup the exact value of same part code
    By PRADEEPB270 in forum Excel General
    Replies: 1
    Last Post: 02-19-2010, 03:05 AM
  5. [SOLVED] Lookup the exact value of same part code
    By PRADEEPB270 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-19-2010, 03:03 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