+ Reply to Thread
Results 1 to 15 of 15

Pre-populate cell based on text in another cell! VLOOKUP not working :(

  1. #1
    Registered User
    Join Date
    09-03-2019
    Location
    Bristol, England
    MS-Off Ver
    Office 2010
    Posts
    27

    Red face Pre-populate cell based on text in another cell! VLOOKUP not working :(

    Hello!!

    I have column B that has data validation in very cell. Users can choose an item from that list. When they choose a text item, I would like a specific number to display in Column D. All text items will have a number assigned to them and I'd like to automatically display in the column (same row). I have set up a table on the same sheet as follows:

    SW Mid 12
    SW Night 10
    RN Night 10
    RN Early 7.5
    RN Mid 7.5
    RN Late 7.5
    SW Early 6
    SW Late 6



    When I use function =VLOOKUP(B2,Y243:Z250,2) on row 2 (or any of them) - it's not working. Some cells have worked but most of them say N/A or it's not displaying the correct number.
    Also - is there a way of writing the function so that if the item on Column B ever gets changed the number in Column D will automatically update?


    Heeeellllppppp

    Thank you in advance.

  2. #2
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Pre-populate cell based on text in another cell! VLOOKUP not working :(

    without a value following the 2 in your formula =VLOOKUP(B2,Y243:Z250,2) Vlookup defaults to true which means your data you are comparing to (Y243:Z250) has to be in ascending order.
    maybe add this to the formula =VLOOKUP(B2,Y243:Z250,2,FALSE)

    AND it’s approximate instead of exact. It will return an exact value if it finds one in your list.
    Last edited by Sam Capricci; 09-26-2019 at 06:13 PM.
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  3. #3
    Valued Forum Contributor loginjmor's Avatar
    Join Date
    01-31-2013
    Location
    Cedar Rapids, Iowa
    MS-Off Ver
    Excel 2013
    Posts
    1,073

    Re: Pre-populate cell based on text in another cell! VLOOKUP not working :(

    Hello -

    It's difficult to determine the problem from your post. I can't tell what information is in Columns A, B, C or D or what your searching through in the range Y243:Z250. This would be much easier if you could post a copy of your spreadsheet (remove any sensitive information).

    Thanks,
    ____________________________________________
    If this has solved your problem, please edit the thread title to add the word [SOLVED] at the beginning. You can do this by
    -Go to the top of the first post
    -Select Thread Tools
    -Select Mark thread as Solved

    If I have been particularly helpful, please "bump" my reputation by pressing the small star in the lower left corner of my post.

  4. #4
    Registered User
    Join Date
    09-03-2019
    Location
    Bristol, England
    MS-Off Ver
    Office 2010
    Posts
    27

    Re: Pre-populate cell based on text in another cell! VLOOKUP not working :(

    Hi both

    So I've attached the spreadsheet (its a copy - unfortunately I couldn't remove the sensitive data from my actual sheet as it's my working version.)

    What I would like it to do in an ideal world....

    1. When I select the 'Shift' - I would like the hours of that shift to appear in the 'Hours' Column

    2. When I select 'Y' in 'Picked up Internally' - I'd like the whole row to turn green and the text to turn black.





    Many thanks in advance
    Attached Files Attached Files

  5. #5
    Forum Expert
    Join Date
    09-25-2015
    Location
    Milan Italy
    MS-Off Ver
    office 365
    Posts
    1,781

    Re: Pre-populate cell based on text in another cell! VLOOKUP not working :(

    D2=IFERROR(VLOOKUP($B2,$Q$51:$R$58,2,0),"")

    copy down


    For conditional formatting

    =$G2="Y" applies to =$A$2:$N$53

    Fill green

    Font style bold

    Color black
    Attached Files Attached Files

  6. #6
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Pre-populate cell based on text in another cell! VLOOKUP not working :(

    as I noted in post #2, add a false to the end of it. AND in this instance also lock in the range of cells so it should look like this... =VLOOKUP(B2,$Q$51:$R$58,2,FALSE)

  7. #7
    Registered User
    Join Date
    09-03-2019
    Location
    Bristol, England
    MS-Off Ver
    Office 2010
    Posts
    27

    Re: Pre-populate cell based on text in another cell! VLOOKUP not working :(

    YES - thanks everyone!!!!!!


    THIS IS THE BEST FORUM EVER!!!!!

    Worked a treat!!!!

    Thank you so much :-D




    Next question:

    I really need to be able to record somewhere on the sheet how many hours were picked up internally. So: If I select 'Y' in column G - I need to do a count of the hours and add them up as a total for the whole month.
    But for every 'blank' in column G - I also need to record the hours from column D

    Does that make sense?

    e.g.

    Hours covered internally: 22.5
    Hours covered externally: 37.5

    Thank you so much.... again! Much appreciated

  8. #8
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Pre-populate cell based on text in another cell! VLOOKUP not working :(

    I don't know how you arrived at your internal and external numbers above but here are two sumproduct formulas you can ADAPT to your workbook.
    =SUMPRODUCT($D$2:$D$53,((TEXT($A$2:$A$53,"mmyyyy")="102019"))*($G$2:$G$53="y"))
    =SUMPRODUCT($D$2:$D$53,((TEXT($A$2:$A$53,"mmyyyy")="102019"))*($G$2:$G$53=""))
    Both key off column A where the month and year are 10/2019 and look down col G for either a Y or a blank (N/A will not be seen) and they both add the totals from column D that coincide with a Y and the shift date being in the month of October.
    If you have need for a more specific date range you could use TEXT($A$2:$A$53,"ddmmyyyy")="01102019" instead (as an example).

  9. #9
    Registered User
    Join Date
    09-03-2019
    Location
    Bristol, England
    MS-Off Ver
    Office 2010
    Posts
    27

    Red face Re: Pre-populate cell based on text in another cell! VLOOKUP not working :(

    YES!!!! Legend! Thank you

    My final question then.... for now..

    Is as follows..

    I am recording shifts that need covering in a care home. Each shift needs to be covered for a specific reason which is from a drop down list I have set up on each row.

    Is there a way of working out how many hours Column D were because of each reason across the month.

    For example

    October 2019

    500 Sickness
    200 Annual
    100 Maternity


    etc etc.... does that make sense?

    Thank you again.

  10. #10
    Registered User
    Join Date
    09-03-2019
    Location
    Bristol, England
    MS-Off Ver
    Office 2010
    Posts
    27

    Re: Pre-populate cell based on text in another cell! VLOOKUP not working :(

    Looks like this:

    10/10/2019 Early 6 Sickness
    10/10/2019 Late 4.5 Sickness
    11/10/2019 Late 6 Annual Leave
    12/10/2019 Early 5 Maternity

  11. #11
    Registered User
    Join Date
    09-03-2019
    Location
    Bristol, England
    MS-Off Ver
    Office 2010
    Posts
    27

    Re: Pre-populate cell based on text in another cell! VLOOKUP not working :(

    Need it to display like this:

    Total Hours for October

    Annual Leave 6
    Sickness 10.5
    Maternity 5

  12. #12
    Forum Expert
    Join Date
    09-25-2015
    Location
    Milan Italy
    MS-Off Ver
    office 365
    Posts
    1,781

    Re: Pre-populate cell based on text in another cell! VLOOKUP not working :(

    Attach the file and indicate the expected result

  13. #13
    Forum Expert
    Join Date
    09-25-2015
    Location
    Milan Italy
    MS-Off Ver
    office 365
    Posts
    1,781

    Re: Pre-populate cell based on text in another cell! VLOOKUP not working :(

    Q
    R
    S
    T
    U
    V
    1
    Annual Leave Sickness Maternity EO121 Vacancy
    2
    Early
    12
    6
    0
    6
    12
    3
    Mid
    31.5
    0
    0
    48
    0
    4
    Late
    25.5
    18
    0
    0
    13.5
    5
    Night
    80
    0
    10
    10
    30



    R2=SUMIFS($D$2:$D$53,$B$2:$B$53,"*"&$Q2,$N$2:$N$53,R$1)

    Copy across and down

    Post # 5 file

  14. #14
    Registered User
    Join Date
    09-03-2019
    Location
    Bristol, England
    MS-Off Ver
    Office 2010
    Posts
    27

    Re: Pre-populate cell based on text in another cell! VLOOKUP not working :(

    YES YES YES!!!! Wahooo…. thank you

  15. #15
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,448

    Re: Pre-populate cell based on text in another cell! VLOOKUP not working :(

    @Leanne
    FYI it is not a good idea to ask a new question not directly related to your original question in the same thread.
    Your first question is VLOOKUP not working, and in post nr 7 you want to count/sum hours with another question.
    Doing this deprives our members from valuable information ( most look only at thread titles) and maybe ( not being the case here), no one would answer your new question depriving you from help.
    In the future, might I suggest starting a new thread and adding a link to any other relevant posts?

+ 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] Indexing to Auto Populate a Cell Based on Multiple Cell Values Not Working on all Options
    By AmandaM73 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-11-2019, 10:17 PM
  2. Looking to auto populate a table based on specific cell text
    By ghansonp in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-05-2016, 04:29 PM
  3. How to populate certain cells based on another cell content [VLOOKUP ]
    By exceleron in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 07-23-2015, 06:28 AM
  4. Auto Populate cell based on Drop Down list in another cell (VLookup)
    By alialmoore in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-27-2013, 04:07 PM
  5. Populate Cell w/ text Based on Another Cell's Color
    By cp41 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-27-2013, 05:04 PM
  6. ### in cell replacing text - vlookup not working
    By aurness in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 04-19-2013, 03:31 PM
  7. [SOLVED] Populate Range with Text based on cell value
    By bcn1988 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-17-2012, 12:35 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