+ Reply to Thread
Results 1 to 4 of 4

Problem with VLOOKUP() function and data formatting

  1. #1
    Registered User
    Join Date
    01-26-2009
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    6

    Problem with VLOOKUP() function and data formatting

    I want to compare column 1 to column 2, the issue is that some fields have both numbers mixed with text so my function is not giving me accurate comparisons:

    current function with the inaccurate results:
    =IF(ISNA(MATCH(A6167, $C$2:$C$12713, 0)), A6167 & " is a financial asset that does NOT match a D7i asset", A6167 & " is a financial asset that matches a D7i asset")

    Proposed function with the possible fix
    =IF(ISNA(VLOOKUP(A2,Sheet1!$C$2:$C$12713,1,FALSE))=TRUE,VLOOKUP(VALUE(A2),Sheet1!$C$2:$C$12713,1,FALSE),VLOOKUP(A2,Sheet1!$C$2:$C$12713,1,FALSE))

    I must be doing something wrong with the Proposed function with the possible fix because it is not giving me accurate comparisons either. Does the propoased fix look right to you?

  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: Problem with VLOOKUP() function and data formatting

    I haven't mocked up a sheet, but the =true right in the middle doesn't appear to be needed.
    _________________
    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
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Problem with VLOOKUP() function and data formatting

    Excel 2007 has a much simpler syntax for testing errors, a function called IFERROR. It can be added into your own sheets. Add this code to your sheet by:
    Alt-F11
    Insert> Module
    Paste in the code below
    Alt-F11
    Save sheet
    Please Login or Register  to view this content.
    Now, you can use this much simpler syntax:

    =IFERROR(FormulaToRun,DoThisIfAnErrorOccurs)

    So, your formula above would be easier to read as:

    =IFERROR(VLOOKUP(A2,Sheet1!$C$2:$C$12713,1,FALSE),"No Match")
    Last edited by JBeaucaire; 01-27-2009 at 12:19 PM.

  4. #4
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Problem with VLOOKUP() function and data formatting

    just to clarify what JB says
    Please Login or Register  to view this content.
    should probably be
    Please Login or Register  to view this content.
    but post workbook for a better reply

+ 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