+ Reply to Thread
Results 1 to 26 of 26

Simple VLookup Formula having Issues

  1. #1
    Registered User
    Join Date
    02-17-2013
    Location
    FL
    MS-Off Ver
    Excel 2003
    Posts
    81

    Simple VLookup Formula having Issues

    Hello, I included a sample to explain my problem.

    So I have been using VLOOKUP's a bunch the last month or so, and am completely stumped at why this isn't working.

    It seems really simple, In Sheet2, cell B2 I create a VLOOKUP formula, but it is not working.

    Using cells A:A from 'sheet2' in the first 1st part of formula.

    Using cells A:C from "sheet1" in the 2nd part of formula.

    and 3,0 as 3rd/4th part of formula so it should match with a number. I also know the names match up on Column A of sheets 1+2.

    Thanks for the help in advance, I wish I didn't have to waste a thread on this but I've wasted so much time trying to figure it out when I have 7 other working VLOOKUP's in the same dang sheet..
    Attached Files Attached Files
    Last edited by jordan1214; 04-14-2013 at 01:10 AM.

  2. #2
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: Simple VLookup Formula having Issues

    self deleted- My apologies, I was looking at the wrong file
    Last edited by dredwolf; 04-14-2013 at 01:26 AM.
    A picture may be worth a thousand words, BUT, a sample Workbook is worth a thousand screenshots!
    -Add a File - click advanced (next to quick post), scroll to manage attachments, click, select add files, click select files, select file, click upload, when file shows up at bottom left, click done (bottom right), click submit
    -To mark thread Solved- go top of thread,click Thread Tools,click Mark as Solved
    If you received helpful response, please remember to hit the * of that post

  3. #3
    Registered User
    Join Date
    02-17-2013
    Location
    FL
    MS-Off Ver
    Excel 2003
    Posts
    81

    Re: Simple VLookup Formula having Issues

    Quote Originally Posted by dredwolf View Post
    Okay, I supplied original solution here, now you want to use VLOOKUP(), which WILL NOT work with your original question, VLOOKUP looks in the first column of a minimum 2 column array for a match, which is why I gave you the INDEX/MATCH solution (which, is faster (by everything I have seen) than VLOOKUP anyways), so...why are you reposting the question?
    What original solution I just posted this? I just pulled a piece for a document I am working on, I am trying to figure out why it isn't working, have tons of similar formulas with same data in my sheet so this one is standing out since it's not working.

    You say that "vlookup looks in the first column of a minimum 2 column array" ...I'm still not sure what that means or why this isn't working. If you can help me out or refer me to what you are talking about that would be great thank you.

  4. #4
    Registered User
    Join Date
    02-17-2013
    Location
    FL
    MS-Off Ver
    Excel 2003
    Posts
    81

    Re: Simple VLookup Formula having Issues

    Quote Originally Posted by dredwolf View Post
    self deleted- My apologies, I was looking at the wrong file
    No problem, but my head was really starting to spin ha, I finally figured out maybe I posted the wrong attachment, but just checked and realized it's the correct one.

    EDIT: Also, I should probably start naming my files better so they don't look similar, I just think people click it right from the thread but I mine as well organize that better.

  5. #5
    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
    52,946

    Re: Simple VLookup Formula having Issues

    the syntax for a vlookup is...

    =VLOOKUP(what-you-want-to-find,range-to-search-in,column-that-contains-the-match,FALSE) FALSE is for finding an exact match

    you have...
    =VLOOKUP(A:A,Sheet1!A:C,3,0)

    the "what-you-want-to-find" needs to be a single cell address, not a range
    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

  6. #6
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: Simple VLookup Formula having Issues

    Again, Sorry, I deleted my post, I was looking at the wrong file

  7. #7
    Registered User
    Join Date
    02-17-2013
    Location
    FL
    MS-Off Ver
    Excel 2003
    Posts
    81

    Re: Simple VLookup Formula having Issues

    Quote Originally Posted by FDibbins View Post
    the syntax for a vlookup is...

    =VLOOKUP(what-you-want-to-find,range-to-search-in,column-that-contains-the-match,FALSE) FALSE is for finding an exact match

    you have...
    =VLOOKUP(A:A,Sheet1!A:C,3,0)

    the "what-you-want-to-find" needs to be a single cell address, not a range
    So you are saying the "A:A" needs to be a single cell, not that whole range?

    I have these working vlookups in the same workbook I am creating:

    =VLOOKUP(C:C,SP!$A:$D,4,0)

    =VLOOKUP(D:D,SP!$A:$C,3,0)



    and in this one I have typed in:


    =VLOOKUP(A:A,Sheet1!A:C,3,0)



    So if I have to suddenly abandon the VLOOKUP for this data point, that is fine, I am just trying to figure out how to get the correct formula to move the data in my sample. Thanks for taking the time to reply.

  8. #8
    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
    52,946

    Re: Simple VLookup Formula having Issues

    hmm ok, I have never seen vlookup() used in that manner and it does seem to work. the problem is that that the names on sheet2 dont exist on sheet1.

    When I copied "Miguel Cabrera" (sheet2 A1), onto sheet2 (anywhere) it found it

  9. #9
    Registered User
    Join Date
    02-17-2013
    Location
    FL
    MS-Off Ver
    Excel 2003
    Posts
    81

    Re: Simple VLookup Formula having Issues

    Quote Originally Posted by FDibbins View Post
    hmm ok, I have never seen vlookup() used in that manner and it does seem to work. the problem is that that the names on sheet2 dont exist on sheet1.

    When I copied "Miguel Cabrera" (sheet2 A1), onto sheet2 (anywhere) it found it
    "Sheet2" has a bigger database than "Sheet1" so most people in sheet2 are definetly in sheet1. You used Miguel Cabrera as an example (A2), he is in both sheets.

    So, my exact question would now become this:

    A2 of Sheet 2 is "Miguel Cabrera". He is also in "Sheet1" I want to pull his cells from sheet 1 over to sheet 2 in cell B2 (Next to his name "Miguel Cabrera in A2)
    Last edited by jordan1214; 04-14-2013 at 01:47 AM.

  10. #10
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Simple VLookup Formula having Issues

    hi jordan1214, you seem to have trailing spaces in the names of Sheet1. so either clean them up using the TRIM formula somewhere & paste over the cells or use this array formula:
    =VLOOKUP(A2,TRIM(Sheet1!$A$1:$C$500),3,0)
    ...confirmed by pressing CTRL-SHIFT-ENTER to activate the array. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL-SHIFT-ENTER you will get an error or a clearly incorrect answer. Press F2 on that cell and try again.

    i usually don't like to range up the whole column. slows down Excel. so just put in more than you would realistically reach

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  11. #11
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: Simple VLookup Formula having Issues

    The problem is you have trailing spaces after names, so an exact match does not work, this:
    =VLOOKUP(A:A&"*",Sheet1!$A:$C,3,0)
    gets rid of most of the errors, but not all,
    I would be looking at ways to reconcile the leading/trailing spaces in the data, before the vlookup, but thats just me..

  12. #12
    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
    52,946

    Re: Simple VLookup Formula having Issues

    Yes I can see what you are trying to do, but i say again, the names on sheet2 do NOT match those on sheet1 (and "Miguel Cabrera" is certainly not in there - give me the row number if he is?...or maybe we are looking in different files lol, I am using sample11 from post1?)

    I used this to just check if the names on sheet2 are on sheet1, it didnt find any matches
    =MATCH(A2,Sheet1!A:A,0)

  13. #13
    Registered User
    Join Date
    02-17-2013
    Location
    FL
    MS-Off Ver
    Excel 2003
    Posts
    81

    Re: Simple VLookup Formula having Issues

    Quote Originally Posted by FDibbins View Post
    Yes I can see what you are trying to do, but i say again, the names on sheet2 do NOT match those on sheet1 (and "Miguel Cabrera" is certainly not in there - give me the row number if he is?...or maybe we are looking in different files lol, I am using sample11 from post1?)

    I used this to just check if the names on sheet2 are on sheet1, it didnt find any matches
    =MATCH(A2,Sheet1!A:A,0)
    Cabrera is on row 104 of sheet 1 and row 2 of sheet 2, but this may be because of the trailing issue they are mentioning.

  14. #14
    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
    52,946

    Re: Simple VLookup Formula having Issues

    aahh yes, i see it now. search functions like vlookup and match are VERY specific - 1 mis=spelling or extra (or missing) space, and it wont find what you are looking for. I should have considered that, sorry

    If you cant get rid of the trailing spaces, try using this...

    =VLOOKUP(A:A&"*",Sheet1!A:C,3,0) (there will still be some names not on sheet1, from what I can see)

    edit: OK I need to look above to see who else has posted what else lol...apologies to dred and beni, i didnt notice you have pretty much already suggested what i did
    Last edited by FDibbins; 04-14-2013 at 02:07 AM.

  15. #15
    Registered User
    Join Date
    02-17-2013
    Location
    FL
    MS-Off Ver
    Excel 2003
    Posts
    81

    Re: Simple VLookup Formula having Issues

    Quote Originally Posted by dredwolf View Post
    The problem is you have trailing spaces after names, so an exact match does not work, this:
    =VLOOKUP(A:A&"*",Sheet1!$A:$C,3,0)
    gets rid of most of the errors, but not all,
    I would be looking at ways to reconcile the leading/trailing spaces in the data, before the vlookup, but thats just me..
    I ran this through and it is matching up my cells correctly. Are you saying it gets rid of most but not all because some show N/A? There's a chance every single player might not match up, so some of those look normal. I'm going through now and seeing if it got 100% of them, but thanks for the help.

  16. #16
    Registered User
    Join Date
    02-17-2013
    Location
    FL
    MS-Off Ver
    Excel 2003
    Posts
    81

    Re: Simple VLookup Formula having Issues

    Quote Originally Posted by FDibbins View Post
    aahh yes, i see it now. search functions like vlookup and match are VERY specific - 1 mis=spelling or extra (or missing) space, and it wont find what you are looking for. I should have considered that, sorry

    If you cant get rid of the trailing spaces, try using this...

    =VLOOKUP(A:A&"*",Sheet1!A:C,3,0) (there will still be some names not on sheet1, from what I can see)
    Thank you very much, dredwolf also just posted this formula, and I confirmed it got 100% of the data. There is some missing because not all names match up perfectly in sheet1 and sheet2, as you suspected. Thanks again for the incredible effort of help.

  17. #17
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: Simple VLookup Formula having Issues

    @ FDibbins, he is there, just has a trailing space, so any exact match without a wildcard will not work...
    my adaptation does work, but I would amend it to this:
    =IFERROR(VLOOKUP(A:A&"*",Sheet1!$A:$C,3,0),"")
    then if any of the blank returns SHOULD have a value, you need to look closer at the data to see why it DOESN'T return a value

  18. #18
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: Simple VLookup Formula having Issues

    @ FDibbins - N0 worry , we got the solution for OP, so all is good

  19. #19
    Registered User
    Join Date
    02-17-2013
    Location
    FL
    MS-Off Ver
    Excel 2003
    Posts
    81

    Re: Simple VLookup Formula having Issues

    Quote Originally Posted by dredwolf View Post
    @ FDibbins - N0 worry , we got the solution for OP, so all is good
    Correct, thanks again everyone. The help is really overwhelmingly good I appreciate it all.

  20. #20
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: Simple VLookup Formula having Issues

    You are welcome

    Please remember to mark the thread as solved if you are satisfied with your solution :
    To mark thread "Solved", go to the top of the thread,click "Thread Tools",click "Mark as Solved"

  21. #21
    Registered User
    Join Date
    02-17-2013
    Location
    FL
    MS-Off Ver
    Excel 2003
    Posts
    81

    Re: Simple VLookup Formula having Issues

    Quote Originally Posted by benishiryo View Post

    i usually don't like to range up the whole column. slows down Excel. so just put in more than you would realistically reach

    This is a very good point, I am making a pretty large worksheet and it is starting to really slow down. I would like to spend time going through it and fixing this. Can you advise me where to reach up on undoing of the "ranging up the whole column". I can deal with it being a little slow, but if I only have to spend some time and can have the same results with excel being quicker, then great.

  22. #22
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Simple VLookup Formula having Issues

    while it seems like there's no impact on using the whole column for a lookup_value, there's no reason to do that. so maybe if you want to go with dredwolf's suggestion, go for:
    =IFERROR(VLOOKUP(A2&"*",Sheet1!$A:$C,3,0),"")

    i would still go for TRIM instead because wildcards looks for entries that contain the name. maybe unlikely, but if you just this name in Sheet2
    Lily Alleness

    and 2 of these in Sheet 1. they will return you the same results
    Lily Allen
    Lily Alleness

    Quote Originally Posted by jordan1214 View Post
    Can you advise me where to reach up on undoing of the "ranging up the whole column". I can deal with it being a little slow, but if I only have to spend some time and can have the same results with excel being quicker, then great.
    i don't have an exact number. the lesser the better. some people have 10,000 rows of data. you can't ask them to go lesser than that. but ranging up say 15,000 rows is better than 1,000,000 over rows. but if you do have such huge data, do consider using dynamic ranges too. google for Excel Table, OFFSET or INDEX to do that.
    Last edited by benishiryo; 04-14-2013 at 03:18 AM. Reason: more info

  23. #23
    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
    52,946

    Re: Simple VLookup Formula having Issues

    From what I could seem there were indeed names on sheet2 that did not appear on sheet1 (I used find/replace to search on names like "Ian Kinsler" - searched for "kin" and couldnt find that name)

  24. #24
    Registered User
    Join Date
    02-17-2013
    Location
    FL
    MS-Off Ver
    Excel 2003
    Posts
    81

    Re: Simple VLookup Formula having Issues

    Quote Originally Posted by benishiryo View Post
    while it seems like there's no impact on using the whole column for a lookup_value, there's no reason to do that. so maybe if you want to go with dredwolf's suggestion, go for:
    =IFERROR(VLOOKUP(A2&"*",Sheet1!$A:$C,3,0),"")

    i would still go for TRIM instead because wildcards looks for entries that contain the name. maybe unlikely, but if you just this name in Sheet2
    Lily Alleness

    and 2 of these in Sheet 1. they will return you the same results
    Lily Allen
    Lily Alleness


    i don't have an exact number. the lesser the better. some people have 10,000 rows of data. you can't ask them to go lesser than that. but ranging up say 15,000 rows is better than 1,000,000 over rows. but if you do have such huge data, do consider using dynamic ranges too. google for Excel Table, OFFSET or INDEX to do that.
    So I realized my vlookup formulas were really slowing down my workbook significantly, I have about 12-16 columns using vlookups on 500 rows of data.

    I changed them all to the the IFERROR, and that seems to slow it down as much if not even more. However, w/ this formula it only seems to be super slow when i change the data.

    Would your suggestion be to try a TRIM formula? I will go back in your posts and try that now..given my situation does that seem best? Thanks again.

  25. #25
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: Simple VLookup Formula having Issues

    The trim() function won't really speed it up, the point was using whole column ranges will slow it down.., limit the range to 1.5 - 2 x the current range range if you do not expect major number differences in amount of data, if the the data is expected to grow lots, go maybe 10x size of current range, if it is completely unpredictable, maybe go for dynamic named ranges...
    At least, that is my take on what benishiryo is trying to tell you, the TRIM() just get's rid of the excess leading and trailing spaces (which may be a better way to go, especially if this is prevalent in your data),
    but the limiting of the range sizes will definitely help improve performance, 500 calculations compared to 1million + per a column and/or cell
    Last edited by dredwolf; 04-16-2013 at 12:24 AM.

  26. #26
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Simple VLookup Formula having Issues

    @dredwolf:
    spot on. that's what i was trying to get across
    =)

    @jordan1214:
    in fact, using my TRIM formula as an array would slow the workbook. but it's for accuracy.

+ 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