+ Reply to Thread
Results 1 to 11 of 11

Trying to format a cell to search for a name then to enter a text if found.

  1. #1
    Registered User
    Join Date
    12-11-2013
    Location
    chepstow
    MS-Off Ver
    Excel 2010
    Posts
    4

    Trying to format a cell to search for a name then to enter a text if found.

    I have a list of names running down colume A :

    EVANS GEOFR
    Holland Tim
    Jenkins Lee
    Matthews Vaugh
    MORTON DAVI
    PHILLIPS BOB
    ROBERTS SIMO


    If Tim is found I need Colume B to say MD
    iF Lee is found I need it to say ED and on .

    Can you help please ?

  2. #2
    Valued Forum Contributor xlbiznes's Avatar
    Join Date
    02-22-2013
    Location
    Bahrain
    MS-Off Ver
    Excel 2007
    Posts
    1,223

    Re: Trying to format a cell to search for a name then to enter a text if found.

    Hi,

    what about the first name EVANS GEOFR ?

    Is your find looking only for Tim and Lee ?
    Happy Computing ,

    Xlbiznes.

    To show your appreciation please click *

  3. #3
    Registered User
    Join Date
    12-11-2013
    Location
    chepstow
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Trying to format a cell to search for a name then to enter a text if found.

    it will be looking for both the first and surname. The name colume has both the first and surname in it.

    The scenario is I have a list of 30 names each of which falls into one of five job functions. I need the spreadsheet to look at the name and insert the function name into the next column save me manually typing it in each time. Can you help please ?

    So the column would need to say if (A1 is either tim walls, john taylor or peter berry then say mechanics for example

  4. #4
    Valued Forum Contributor xlbiznes's Avatar
    Join Date
    02-22-2013
    Location
    Bahrain
    MS-Off Ver
    Excel 2007
    Posts
    1,223

    Re: Trying to format a cell to search for a name then to enter a text if found.

    Hi,

    Why don't you maintain a master file with the name and the designation and then you can do a vlookup against the name.

    Attached is an example , i hope you can adapt to your requirement accordingly
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    12-11-2013
    Location
    chepstow
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Trying to format a cell to search for a name then to enter a text if found.

    That is really helpful. Could you please explain the formula to me thou. I get the lookup Idea but not the formula. Sorry to be a pain

  6. #6
    Valued Forum Contributor xlbiznes's Avatar
    Join Date
    02-22-2013
    Location
    Bahrain
    MS-Off Ver
    Excel 2007
    Posts
    1,223

    Re: Trying to format a cell to search for a name then to enter a text if found.

    As you can see that we are maintaining the staff list in one of the sheets name "Master_List". Using Vlookup you will query this list and look for the name and in the array and return the 2nd column that is the department data.

    =VLOOKUP(A2,Master_List!$A$2:$B$8,2,FALSE)

    Vlookup( = The function starts
    A2 = is name EVANS GEOFR against which we are going to search in the master_list sheet
    Master_List!$A$2:$B$8 = this the array which hold the name and the department (Column A (Staff Name) and Column B (Department Name)
    2 = We want the function to return the data in the 2nd column (Department Name)
    False = It should be an exact match of the name that we are searching for
    ) Function ends

  7. #7
    Registered User
    Join Date
    12-11-2013
    Location
    chepstow
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Trying to format a cell to search for a name then to enter a text if found.

    Thank you ever so much. I have done this to the document but there are errors occurring and I can't work out why would you please advise see attached sheet. I need this formula to run down the whole column as the data in the first few columns will change
    Attached Files Attached Files

  8. #8
    Valued Forum Contributor xlbiznes's Avatar
    Join Date
    02-22-2013
    Location
    Bahrain
    MS-Off Ver
    Excel 2007
    Posts
    1,223

    Re: Trying to format a cell to search for a name then to enter a text if found.

    Hi,

    Check the comments in the sheet.
    Attached Files Attached Files

  9. #9
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,044

    Re: Trying to format a cell to search for a name then to enter a text if found.

    xlbiznes, nice formula just a quick suggestion...its good practice to add the last argument in a vlookup(), just to make sure you dont forget it when you really do need to use it
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  10. #10
    Valued Forum Contributor xlbiznes's Avatar
    Join Date
    02-22-2013
    Location
    Bahrain
    MS-Off Ver
    Excel 2007
    Posts
    1,223

    Re: Trying to format a cell to search for a name then to enter a text if found.

    @FDibbins,

    I seem to have missed that in my replied.xlsx file.

    Thank you for your reminder.

  11. #11
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,044

    Re: Trying to format a cell to search for a name then to enter a text if found.

    you are welcome

+ 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. Search cell for multiple text , return comma separated text in separate cell if found
    By dangerdoug in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-01-2013, 01:52 PM
  2. Replies: 1
    Last Post: 11-05-2012, 09:23 PM
  3. Replies: 3
    Last Post: 10-25-2012, 12:49 AM
  4. Replies: 2
    Last Post: 11-24-2010, 05:44 PM
  5. Search a Range for a phrase and Format cell if found
    By Leaper@FakeEail.cooo in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-26-2005, 06:05 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