+ Reply to Thread
Results 1 to 4 of 4

Display Cell if Text is Found Within cell

Hybrid View

  1. #1
    Registered User
    Join Date
    04-25-2012
    Location
    Connecticut
    MS-Off Ver
    Excel 2003
    Posts
    4

    Display Cell if Text is Found Within cell

    Hello, first and foremost, I've tried searching for this issue and I usually find what I need on the forums, but this one has me stumped.

    What I'm trying to do is basically this:

    I have a list of data in A1:A50 that has peoples first & last names. I'm using the ENVIRON("Username") command to retreive the name of the person who opens the workbook. Our office has it set-up so that it first letter of first name, full last name, so I'll use the mid function to remove just the last name, and then I want to take that last name, find it in the list of A1:A50, and then display the entire contents of whatever cell it's found in.

    Basically, my excel sheet might look like:

    (A1)From: John Smith
    (A2)From: Jane Doe
    (A3)From: Bob Thomas

    The environ command will give me the value of "thomas", when Bob opens the sheet, and I want it then display "From: Bob Thomas", after it matches the last name to cell A3, I want it to display the contents of A3.

    Would appreciate any help.

    Thanks.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Display Cell if Text is Found Within cell

    =VLOOKUP("* "&X2,A1:A3,1,0)

    where X2 contains result the last name to find..... this will only find first occurance if there are multiple similar lastnames...
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Forum Expert DGagnon's Avatar
    Join Date
    02-23-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2003, 2007
    Posts
    1,645

    Re: Display Cell if Text is Found Within cell

    you can use a vlookup to do this, something like this

    =VLOOKUP("*" & LASTNAME & "*",A:A,1,0)
    If you liked my solution, please click on the Star -- to add to my reputation

    If your issue as been resolved, please clearly state so and mark the thread as [SOLVED] using the thread tools just above the first post.

  4. #4
    Registered User
    Join Date
    04-25-2012
    Location
    Connecticut
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Display Cell if Text is Found Within cell

    I feel pretty dumb. Worked perfectly. Thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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