+ Reply to Thread
Results 1 to 16 of 16

Pre-filling data based on a cell

  1. #1
    Registered User
    Join Date
    09-04-2012
    Location
    Lausanne
    MS-Off Ver
    Excel Mac 2011
    Posts
    9

    Question Pre-filling data based on a cell

    Hello,

    I am trying to build a printable A5 birthday voucher (or at least exportable as PDF) for my clients. I have three data lists: their name, their DOB & their email address.

    What I want to do is select from the drop-down list a customer's name, then the DOB be pre-filled in another sell automatically. Thus, the DOB cell must correspond, and automatically fill, based on the name selected from the drop-down list.

    I apologise if this has been answered before, I've spent 45mins looking in the forum, and have learnt a lot, but I still don't have a solution to this problem. Any help would be appreciated.

    Thank you.


    Jake Leslie,

  2. #2
    Valued Forum Contributor
    Join Date
    06-10-2011
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    341

    Re: Pre-filling data based on a cell

    Say you have the name in cell A2, and want DOB and email to populate in B2 and C2.
    You might have the data in a sheet called data with names in column A, DOB in B and email in C.
    What you would do is VLOOKUP(A2,Data!A:C,2,FALSE) in B2 and VLOOKUP(A2,Data!A:C,3,FALSE) in C2

    provided every customer name appears only once in the list

  3. #3
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Pre-filling data based on a cell

    If your list in on Sheet2 A2:C500 with A being name, B being DOB and C being Email address
    And your drop down list is in A1
    Then
    =IF(ISTEXT(A1),VLOOKUP(A1,Sheet2!$A$2:$C$500,2,FALSE)
    Is that what you are looking for?
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  4. #4
    Registered User
    Join Date
    09-04-2012
    Location
    Lausanne
    MS-Off Ver
    Excel Mac 2011
    Posts
    9

    Thumbs up Re: Pre-filling data based on a cell

    Thank you both for your responses...

    That is now working perfectly for me:
    =VLOOKUP(A5,'Birthday List'!B:D,3,FALSE)

    However, I will certainly have duplications in names. Is there a way to assign a unique key to each row of data automatically?

    Thanks !

  5. #5
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Pre-filling data based on a cell

    If you have two John Smith's, how will Excel know which DOB to pull up?

  6. #6
    Registered User
    Join Date
    09-04-2012
    Location
    Lausanne
    MS-Off Ver
    Excel Mac 2011
    Posts
    9

    Re: Pre-filling data based on a cell

    Exactly. If I have two John Smiths, how will Excel know which DOB to bring up?

  7. #7
    Valued Forum Contributor Melvinrobb's Avatar
    Join Date
    06-19-2012
    Location
    Manitoba, Canada
    MS-Off Ver
    Excel 2013
    Posts
    1,128

    Re: Pre-filling data based on a cell

    You will need to create a Unique Key for each row. How you do this is completely up to you. One option is to insert a Unique Key Column in column A and use the following formula in A5 and drag down (assuming Name is in column B)
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Use this column as your drop down.
    Please click the * icon below if I have helped.

  8. #8
    Registered User
    Join Date
    09-04-2012
    Location
    Lausanne
    MS-Off Ver
    Excel Mac 2011
    Posts
    9

    Re: Pre-filling data based on a cell

    I didn't quite understand how =B5&COUNTIF($B$5:B5,B5) that works? However that's alright. I just entered =A2+1 where A2 is the above cell.

    Now what I need to know is how to retrieve the correct DOB for John Smith (ID# 12) when there is also a John Smith (ID# 23).

    Thanks a million.

  9. #9
    Registered User
    Join Date
    09-04-2012
    Location
    Lausanne
    MS-Off Ver
    Excel Mac 2011
    Posts
    9

    Re: Pre-filling data based on a cell

    Also, I have the DOB list now with two separate columns of information (1. day & month, 2. year), because I want the gift certificate to display the birthday as 'dddd d mmmm' without the year... However, when I have the field 'valid until' as the birthday cell + 4 weeks (validity of voucher), then it adds it from the current year, when I need it to be from the coming year. I.e. If we're in September and John Smith's birthday is on 24 August, it lists his birthday as Friday 24 August (i.e. from 2012), where I would like it do present the birthday from 2013. Is this possible?

  10. #10
    Valued Forum Contributor Melvinrobb's Avatar
    Join Date
    06-19-2012
    Location
    Manitoba, Canada
    MS-Off Ver
    Excel 2013
    Posts
    1,128

    Re: Pre-filling data based on a cell

    The formula adds up the number of times the name has occured so far. If B5 = "John Smith", the Unique Key will be "John Smith1". The next "John Smith" will have a unique Key of "John Smith2".

    The drop-down menu must use the "Unique Key" column if you want to use vlookup, as unique values are needed for vlookup.

    With the additional requirement, you'll need to upload a sample workbook for me to help you out.

  11. #11
    Registered User
    Join Date
    09-04-2012
    Location
    Lausanne
    MS-Off Ver
    Excel Mac 2011
    Posts
    9

    Re: Pre-filling data based on a cell

    G'day melvinrobb,

    Here is the worksheet I am working from.

    Thanks for your help mate.
    Attached Files Attached Files

  12. #12
    Valued Forum Contributor Melvinrobb's Avatar
    Join Date
    06-19-2012
    Location
    Manitoba, Canada
    MS-Off Ver
    Excel 2013
    Posts
    1,128

    Re: Pre-filling data based on a cell

    Don't think I'm going to be able to help you out with this. the only notes I can give you are
    1. Base vlookup only on unique values (Ex. John Smith1)
    2. You might want dependant drop down lists, instead of vlookup. Once you have selected the name, the dates that appy to that name will only appear in the DOB dropdown. this link might help: http://www.get-digital-help.com/2010...lues-in-excel/
    3. I highly recommend keeping the complete date in one cell, and formatting where applicable. use the "DATE" formula to draw out the info you want from the cell.

  13. #13
    Registered User
    Join Date
    09-04-2012
    Location
    Lausanne
    MS-Off Ver
    Excel Mac 2011
    Posts
    9

    Re: Pre-filling data based on a cell

    G'day Melvinrobb,

    I've got the spreadsheet working pretty well now. The only two issues (which are minor) are:
    1. I have to perform a VLOOKUP [=VLOOKUP(A6,'Birthday List'!B:D,3,FALSE)] in a cell outside the worksheet, then establish the anniversary date using the EDATE function you suggested [=EDATE(G6,ROUNDUP(YEARFRAC(TODAY(),G6),0)*12)] within the worksheet printable area. So, this works, but it would be nice to have the full command in one cell.
    2. I still don't have a solution to the duplication of entries, i.e. John Smith 1, 2 & 3 all with different birthdays. However, to be honest, this is not a problem at all, as it will take all of 5 seconds to sort through the list and find the correct client.
    So, in conclusion... that's a win. Thanks for your help!

  14. #14
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Pre-filling data based on a cell

    Better late than never. Here's what I did.
    1. I made your defined names dynamic using OFFSET( See http://www.contextures.com/xlNames01.html#Dynamic )
    2. I added a key which you could hide (Col E)
    3. I Used a formula in Col G to reproduce the name you chose on your voucher the number of times it appears in your BD list.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    4. I used another formula to pull over the corresponding DOB's based on Col G and the Keys
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    5. On your voucher, I switched from a VLOOKUP to a Data Validation dropdown list pointing at Col H
    6. For your expiry date, I used this formula
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    See attachment
    Attached Files Attached Files

  15. #15
    Registered User
    Join Date
    09-04-2012
    Location
    Lausanne
    MS-Off Ver
    Excel Mac 2011
    Posts
    9

    Re: Pre-filling data based on a cell

    Chemist, I can't thank you enough. That works perfectly, and that was such a professional answer. Thank you very much.

  16. #16
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Pre-filling data based on a cell

    @ beleza.jake

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. I'll do that for you now but please keep in mind for your future threads that Rule #9 requires you to do that yourself. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

    Also, as a new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ 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