+ Reply to Thread
Results 1 to 7 of 7

vlookup problem and count problem

  1. #1
    Registered User
    Join Date
    05-28-2009
    Location
    Hong Kong
    MS-Off Ver
    Excel 2003
    Posts
    11

    vlookup problem and count problem

    I try the nested for-loop at the past, but data checking is time consuming. So I decide to use vlookup to compare and get the data from another worksheet. I have searched many samples which is only for one workbook. In my code, the variable 'found' get error result, all values are display "NULL".

    Please help to solve it...thank you!

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by thy00123; 06-05-2009 at 06:41 AM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: vlookup problem and count problem

    Try these changes:
    Please Login or Register  to view this content.
    When you opened the workbook, it became the the focused workbook so you don't have to keep referring to the bookname until you give focus to another workbook, like when you open the next book.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    05-28-2009
    Location
    Hong Kong
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: vlookup problem and count problem

    counting problem is solved...thanks, but vlookup problem is still existed

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: vlookup problem and count problem

    I think you would need to post a sample so we can see the data types in play etc... does the same VLOOKUP entered natively return expected results ? ie

    Z4: =VLOOKUP(C4,Sheet2Name,11,0)

  5. #5
    Registered User
    Join Date
    05-28-2009
    Location
    Hong Kong
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: vlookup problem and count problem

    the sample is uploaded....please unzip it in c:\
    the marco program is implemented in "b.xls"
    b.xls and AA.xls also contain the asset number
    i want to compare their asset number and find the activity cause.
    finally, write the activity cause into b.xls

  6. #6
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: vlookup problem and count problem

    Your lookup range is not correct for a VLOOKUP... in a VLOOKUP the criteria must exist in the leftmost column of the range... your range utilises the .UsedRange of the 2nd sheet which is A:K but the ID number you wish to find is in Column E not A -- hence the VLOOKUP returns an error.

    I have to go offline now but you could think about using an INDEX/MATCH approach, ie replace:

    Please Login or Register  to view this content.
    with

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    05-28-2009
    Location
    Hong Kong
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: vlookup problem and count problem

    when using match method, the result is correct. Thank you

+ 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