+ Reply to Thread
Results 1 to 9 of 9

Autofill adjacent cell from pre-defined list

  1. #1
    Registered User
    Join Date
    03-19-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    5

    Autofill adjacent cell from pre-defined list

    Hello,

    Relative newbie trying to bumble through making lists.

    Is there any way to set a formula or macro so that if a name is typed into a column (say column A), a corresponding piece of data will appear or autofill in an adjacent column (say column F) provided the data is recognised from a pre-set list.

    For example Column A (A1 - A1000000) is a list of full names of footballers (Forename and Surname) and Column F is a list of the team they play for.

    Every time the same name is typed into a cell in column A I would like the team name to appear in column F. For example if cell A9 contains "Ryan Giggs", cell F9 will automatically fill with "Manchester United" as long as this link has been defined in the list, if cell A10 contains "Didier Drogba" cell F10 will fill with "Chelsea". If the name in column A is not recognised, the corresponding cell in column F would return "default" or "unknown".

    My very cursory fiddling suggests there should be a way to do it with the IF formula, but I can't see how you could include a longer list of potential names and matches in the IF formula.

    Apologies if this, my first post, is not in the correct format for the forum or in the right place.

    I'd be so grateful if anyone could give me a hand with this.

    Cheers.

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

    Re: Autofill adjacent cell from pre-defined list

    you can do this, it would be a simple VLOOKUP but based on your description im not certin where your list is that already contains the names and teams. assuming it is in column H:I for example you could do soemthing like this in column F1

    =VLOOKUP(A1,H:I,2,0)

    if you have a small sample sheet with layout i could buld the example for that layout.
    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.

  3. #3
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Autofill adjacent cell from pre-defined list

    Hi Seeded_Batch,


    Welcome to the forum.

    Would suggest you to try exploring Vlookup function over google which seems to be a possible solution to your query. Post the sample file in case of any issues. Thanks.

    Regards,
    DILIPandey

    <click on below 'star' if this helps>
    DILIPandey, Excel rMVP
    +919810929744 (India), +971528225509 (Dubai), dilipandey@gmail.com

  4. #4
    Registered User
    Join Date
    03-19-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Autofill adjacent cell from pre-defined list

    Thanks for your reply,

    I sort of see what you mean with VLOOKUP using two columns (H:I in your example) as the preset list, presumably where column H=full name and column I=team but I'm still uncertain as to how to define the relationship between each column in the formula. Can you explain a little more.

    I've only just recently worked out VLOOKUP and only at it's most basic. I suppose I figured VLOOKUP was only good for one name, so you could set it to recognise 1 name and repeat the pattern down a column when you autofill if that name is TRUE/FALSE, but I don't know how to get it to recognise multiple names in the same column.

  5. #5
    Registered User
    Join Date
    03-19-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Autofill adjacent cell from pre-defined list

    Thanks DILIPandey,

    I will do a little more research into it along with the advice of DGagnon.

    Many Thanks

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

    Re: Autofill adjacent cell from pre-defined list

    what vlookup will do is look for an item (in this case A1) which is actualy your player name. it will then go to the lookup range (in this case H:I) and look at the first column of that range top to bottom until it finds a match. once it finds a match it will move over to column # x in the range (in this case to column 2). the last entry of true/false (or 1/0) is to make it find an exact match, which is nessacary when searching text.

    i hope this helps you understand the workings. it is also worth noteing, if a playes name were to appear 2 times in your lookup range, it would identify the first one as the match.

  7. #7
    Registered User
    Join Date
    03-19-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Autofill adjacent cell from pre-defined list

    Thanks DGagnon,

    That's really helpful. I'll have a go at it this evening and maybe post back if I can get my head around it.

    Best

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

    Re: Autofill adjacent cell from pre-defined list

    sounds good, if you have any issues, just post a workbook including what you have tried, and we can work it out for you.

  9. #9
    Registered User
    Join Date
    03-19-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Autofill adjacent cell from pre-defined list

    DGagnon's answer worked perfectly for this problem. I've got it all working now.

    Many Thanks for the super swift replies.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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