+ Reply to Thread
Results 1 to 15 of 15

Vlookup not working properly

  1. #1
    Registered User
    Join Date
    01-29-2007
    Posts
    69

    Vlookup not working properly

    I am having some trouble with Vlookup.
    Example:
    Workbook A- is full of vlookup formulas that worked perfectly.

    I copied Workbook A and renamed it Workbook B.

    Workbook A and B vlookups should be looking at another source Workbook C for matches.

    I used the find and replace function to make changes to workbook b that needed to be made and my vlookups still worked fine. The only time i run into a snag with the vlookup result is if i manually type my data into a vlookup reference cell or copy and paste text into it.
    If i copy and paste the text from workbook c the vlookups work.
    Again manually typing the same text with same spacing doesnt work or if i copy and paste from somewhere else other than workbook c it doesnt work.
    Any suggestions why it would not work with this scenario?
    Thanks

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Vlookup not working properly

    Attach a sample workbook. Make sure there is just enough data to make it clear what is needed. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are demonstrated, mock them up manually if needed. Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Registered User
    Join Date
    01-29-2007
    Posts
    69

    Re: Vlookup not working properly

    When i try to create a sample workbook it works fine. That is what is puzzling.
    I will continue to try to replicate the issue and upload once i can get it to repeat.

    The copied file is the only problem "Workbook B"
    For example cell f5 has to look at b5 as a reference.
    Formula in f5 =IF(ISBLANK(B:B),"",VLOOKUP(B:B,'C:\Documents and Settings\rstevens1\Desktop\Window Takeoffs\Plygem Window Pricing\Window Pricing Templates\[Window Pricing Sheet.xlsx]Sheet1'!$A:$C,2,FALSE))

    So whatever is in b5 it looks at "Workbook C" and returns the result of the vlookup for column 2 into cell F5.
    If i manually type the exact same thing from workbook c into b5 i get #n/a. if i copy the text from workbook c it returns a value.

    This only occurs when i copy a workbook and rename it.

    Again, if i can replicate the issue i will upload sample files.

    thanks

  4. #4
    Registered User
    Join Date
    01-29-2007
    Posts
    69

    Re: Vlookup not working properly

    I figured out what my issue was. I had trailing spaces in the workbook that contained the data where Vlookup was searching.
    I had someone help me with vba code which confirmed this. It fixed one sheet but not all of the sheets in the workbook. What part of this code needs to be changed to have it run through the entire workbook?
    Please Login or Register  to view this content.

  5. #5
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Vlookup not working properly

    Hi Jessier,

    I'm not really clear on what you're doing, but this should do it to every sheet in your book:

    Please Login or Register  to view this content.
    Edit* Oh Bummer, I had your code still on my clipboard - I'll post the correction tomorrow when I have my other machine up - Sorry!
    Last edited by xladept; 01-24-2014 at 09:45 PM.

  6. #6
    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,926

    Re: Vlookup not working properly

    For a start off, you need to adjust some of the ranges in your formula...
    =IF(ISBLANK(B:B),"",VLOOKUP(B:B,'C:\Documents and Settings\rstevens1\Desktop\Window Takeoffs\Plygem Window Pricing\Window Pricing Templates\[Window Pricing Sheet.xlsx]Sheet1'!$A:$C,2,FALSE))
    to something like thtis...
    =IF(IB2="","",VLOOKUP(trim(B2),'C:\Documents and Settings\rstevens1\Desktop\Window Takeoffs\Plygem Window Pricing\Window Pricing Templates\[Window Pricing Sheet.xlsx]Sheet1'!$A:$C,2,FALSE))

    Also, it will probably speed things up a bit if you restricted the ranges to jusat what you need, instead of using entire columns
    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

  7. #7
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Vlookup not working properly

    I think here is your problem

    =IF(ISBLANK(B:B),"",VLOOKUP(B:B,'C:\Documents and Settings\rstevens1\Desktop\Window Takeoffs\Plygem Window Pricing\Window Pricing Templates\[Window Pricing Sheet.xlsx]Sheet1'!$A:$C,2,FALSE))

    1. It is your range. It has to be B:C not A:C

    2. you can't lookup B:B it has to be cell reference.
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  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,926

    Re: Vlookup not working properly

    Good catch, AlKey, I should have spotted that too

  9. #9
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Vlookup not working properly

    Quote Originally Posted by FDibbins View Post
    Good catch, AlKey, I should have spotted that too
    Well, four of eyes better than two

  10. #10
    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,926

    Re: Vlookup not working properly

    maybe so, but I already have 4 (I wear glasses lol)

  11. #11
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Vlookup not working properly

    Quote Originally Posted by FDibbins View Post
    maybe so, but I already have 4 (I wear glasses lol)
    then I miscalculated. It should've been 8 then. (I were glasses too

    BTW, thanks for Reps

  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,926

    Re: Vlookup not working properly

    well deserved

  13. #13
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Vlookup not working properly

    Hey,

    I wear glasses too - ever since I turned 45 (30years)!

  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,926

    Re: Vlookup not working properly

    darn kids!! I started at 16 (I think), 40 years ago

  15. #15
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Vlookup not working properly

    Here's what I thought I was posting at #5:

    Please Login or Register  to view this content.

+ 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. VLOOKUP not properly working
    By amphinomos in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-01-2013, 05:35 AM
  2. VLOOKUP() not working properly
    By ckgeary in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-28-2013, 01:32 PM
  3. [SOLVED] vlookup not working properly
    By djmatok in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 01-25-2013, 12:19 PM
  4. Vlookup not working properly
    By b_motl in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-15-2008, 03:12 PM
  5. Vlookup not working properly
    By Jaime in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-21-2006, 05:00 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