+ Reply to Thread
Results 1 to 4 of 4

How Do I Find and Return a String When Only Part of that String is Known?

  1. #1
    Registered User
    Join Date
    11-07-2014
    Location
    London
    MS-Off Ver
    2010
    Posts
    2

    How Do I Find and Return a String When Only Part of that String is Known?

    I'm sure this should be easy but I am stumped. I have used pretty simple Vlookup and Index queries in the past but am struggling to get my head round this: I am using Excel 2007.

    I have a column of data A1 to A5000. It contains product ID's in the following format:

    1ABC12AB-1234

    I want to find a record using just the 1234 part (which is unique to each record) of the string but return the complete cell contents to populate another column.

    The first part of the string is not always the same length, it could be 1ABC12ABCD etc but the part after the hyphen is always 4 characters long. Also there are no duplicate records.

    Basically i want to type: "1234" in one cell and get "1ABC12AB-1234" to magically appear in the cell next to it.

    Any help would be much appreciated!

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: How Do I Find and Return a String When Only Part of that String is Known?

    try using match function

    Use this as your starting point:
    =OFFSET(A$1,MATCH("*" &C2 &"*",A$2:A$6,0),0)
    Attached Files Attached Files

  3. #3
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: How Do I Find and Return a String When Only Part of that String is Known?

    Use a wildcard.

    =INDEX(A1:A5000,MATCH("*"&"1234",A1:A5000,0))

    The wildcard means anything, so it's looking for anthing+1234
    Make Mom proud: Add to my reputation if I helped out!

    Make the Moderators happy: Mark the Thread as Solved if your question was answered!

  4. #4
    Registered User
    Join Date
    11-07-2014
    Location
    London
    MS-Off Ver
    2010
    Posts
    2

    Re: How Do I Find and Return a String When Only Part of that String is Known?

    Thank you mehmetcik that does exactly what I needed!

    daffodil11 thanks also for your reply that has added to my limited knowledge.

    Thanks, very happy now

    p.s. mehmetcik, thanks for the example spreadsheet too.
    Last edited by Foamy; 11-08-2014 at 05:33 AM. Reason: added a ps.

+ 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] Return value from a table when value is part of a text string
    By Shorrocks in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-20-2014, 01:02 PM
  2. [SOLVED] Find a string by VBA Regular Expression and replace a part of that string
    By taps in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-25-2013, 11:08 AM
  3. Mid function to return part of String
    By stoney1977 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-02-2008, 07:25 PM
  4. function to return part of a string
    By sarabella in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-18-2007, 03:00 PM
  5. [SOLVED] Find a part of a string
    By Peter Pantus in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-15-2005, 05: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