Consulting

Results 1 to 10 of 10

Thread: Solved: VLOOKUP Problem

  1. #1
    VBAX Mentor
    Joined
    Nov 2008
    Posts
    305
    Location

    Solved: VLOOKUP Problem

    Is there any reason why the VLOOKUP returns N/A error for any values that exist after row 3593?

    The following formula
    =VLOOKUP($D$18;'C:\\myworksheet.xls]Sheet1'!$C:$D;2;FALSE)
    Is returning NA for every value after row 3593.

    Thanks

  2. #2
    Should be comma's

    [vba]=VLOOKUP($D$18,'C:\[myworksheet.xls]Sheet1'!$C:$D,2,FALSE)[/vba]

  3. #3
    =VLOOKUP($D$18,'C:\[myworksheet.xls]Sheet1'!$C:$D,2,FALSE)

  4. #4
    VBAX Mentor
    Joined
    Nov 2008
    Posts
    305
    Location
    Not in Danish version.

  5. #5
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,060
    Location
    From Excel Help
    • If the range_lookup argument is FALSE, VLOOKUP will find only an exact match. If there are two or more values in the first column of table_array that match the lookup_value, the first value found is used. If an exact match is not found, the error value #N/A is returned.
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  6. #6
    VBAX Mentor
    Joined
    Nov 2008
    Posts
    305
    Location
    Unfortunately, in order to test that the system works, I have copy/pasted the result I want to find- that way I know that an exact match exists.
    However it's still producing #N/A results.

    On another matter, I've tried another vlookup where the array to lookup in is A:B I know the result can be found in column B, and I need it to return the column A result. Can this be done, I've tried using -1 but to no avail.
    I can't swap the columns around, as the searching excel file is external, and not under my control.
    Ideas?

    Thanks

  7. #7
    VBAX Regular arkusM's Avatar
    Joined
    May 2007
    Location
    Calgary
    Posts
    52
    Location
    Like Aussiebear says vlookup looks for an exact match so if you know the data is in the source array then there is something else that is causing the vlookup to fail, you need to isolate that issue.
    Sometimes there is crappy bits in the data, like extra spaces or a ' in the data. This always screws up the vlookup and is not obvious when you look at the data or copy and paste the data because Excel does not display the '.

    If it is a spacing issue you can try

    =VLOOKUP(Trim($D$18);'C:\\myworksheet.xls]Sheet1'!$C:$D;2;FALSE)

    However if it is a ' issue then it is trickier. There is a way to get rid of the extra ', but I don't recall off the top of my head try googleing it.
    Last edited by arkusM; 03-12-2010 at 07:18 AM.
    Excel 2003, WinXP

  8. #8
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Quote Originally Posted by ukdane
    On another matter, I've tried another vlookup where the array to lookup in is A:B I know the result can be found in column B, and I need it to return the column A result
    =INDEX(A:A,MATCH(D1,B:B,0))
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  9. #9
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,060
    Location
    Vlookup is unable to return a value from a column to the left of the initial lookup column, so you will need to use MD's alternative
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  10. #10
    VBAX Regular arkusM's Avatar
    Joined
    May 2007
    Location
    Calgary
    Posts
    52
    Location
    I know the result can be found in column B, and I need it to return the column A result.
    Good Catch MD, I guess that is why you are the Wizard.
    Excel 2003, WinXP

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •