+ Reply to Thread
Results 1 to 14 of 14

Vlookup giving Wrong Results

  1. #1
    Valued Forum Contributor
    Join Date
    11-15-2007
    Location
    England
    MS-Off Ver
    Office Pro Plus 2021
    Posts
    424

    Vlookup giving Wrong Results

    Hi

    This is a bit complicated so I have attached a workbook with explanations in the columns.

    Thanks for any help.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Vlookup giving Wrong Results

    Wouldn't
    =AD2
    in AH2
    and copied down give you your expected results?

  3. #3
    Valued Forum Contributor
    Join Date
    11-15-2007
    Location
    England
    MS-Off Ver
    Office Pro Plus 2021
    Posts
    424

    Re: Vlookup giving Wrong Results

    No because the the Ref1 figures are from one report and the Ref2 are from another. That's why I said there were less rows of data in one column than the other.

    The point of the excercise is to reconcile the two columns of figures and I just need to get the figures in column AH to be in the same order as those in Column AD so that figures are the same and I can where there are variances.

    It was difficult to show on the example but Column AH has blank cells where there was no corresponding number in the vlookup.

  4. #4
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Vlookup giving Wrong Results

    Can you post your expected results?

  5. #5
    Valued Forum Contributor
    Join Date
    11-15-2007
    Location
    England
    MS-Off Ver
    Office Pro Plus 2021
    Posts
    424

    Re: Vlookup giving Wrong Results

    Hi yudlugar,

    Not easily the file is so big.

    Basically the Ref1 Numbers in Col AD and the Ref1 Units in Col AJ are from the same file.

    The numbers in Ref2 are fom a different file.

    My objective is to look at the figure in say AD2 - 9780486266848 and if that figure anywhere in column AF then return 248 in Col AK2. If 9780486266848 doesn't exist then return a zero in col AK2.

    Hope thant makes sense.
    Last edited by timbo1957; 11-15-2013 at 04:57 AM.

  6. #6
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Vlookup giving Wrong Results

    ok
    =IF(COUNTIF(AF1:AF1000,"="&AD2)>0,248,0)

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

    Re: Vlookup giving Wrong Results

    hi timbo. what you want is really bizarre. perhaps the file is a little confusing. my assumption is your worksheet in 1 file has only got:
    - Column AD (Ref1)
    - Column AJ (Ref1 Units)

    is that right? you want to compare if the Ref2 has the same number of units? when you are going to use VLOOKUP to pick up the Ref2 units in AK2, you are already looking for AD2. why do you need to have a Column AH doing a VLOOKUP? so if you really need one, it's like what yudlugar suggested in post #2. if your concern is about Ref2 having lesser records & you don't want it to show up in column AH, then you should do the VLOOKUP the other way round in AH2:
    =IF(ISNA(VLOOKUP(AD2,$AF$1:$AF$14452,1,0)),0,VLOOKUP(AD2,$AF$1:$AF$14452,1,0))

    i'm assuming you might still have to use Excel 2003? otherwise, Excel 2007 & above can use a shorter version:
    =IFERROR(VLOOKUP(AD2,$AF$1:$AF$14452,1,FALSE),0)
    Last edited by benishiryo; 11-15-2013 at 05:20 AM. Reason: edited content

    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

  8. #8
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Vlookup giving Wrong Results

    Slight change to my formula:
    =IF(COUNTIF($AF$1:$AF$1000,"="&AD2)>0,248,0)

    You need to replace 248 with the location of the reference...

  9. #9
    Valued Forum Contributor
    Join Date
    11-15-2007
    Location
    England
    MS-Off Ver
    Office Pro Plus 2021
    Posts
    424

    Re: Vlookup giving Wrong Results

    Genius yudlugar!

    I wound never have thought of using Countif.

    Many thanks.

    I'd add to your rep. but it won't let me!

  10. #10
    Valued Forum Contributor
    Join Date
    11-15-2007
    Location
    England
    MS-Off Ver
    Office Pro Plus 2021
    Posts
    424

    Re: Vlookup giving Wrong Results

    Hi yudlugar,

    One more question. I need to put your calcuation into a piece of code and I am obvisously doing something wrong becuase it is returning FALSE any help would be appreciated.

    Please Login or Register  to view this content.

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

    Re: Vlookup giving Wrong Results

    please don't assume because someone does formulas/functions they also do code which is a different if complimentary field. if you have a vba question mark this as solved since the countif or whatever does what you want then start a new thread in the vba sub forum linking to this one if you feel the need to. thanx
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  12. #12
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Vlookup giving Wrong Results

    martin, in this case, I'd helped timbo on a couple of other vba threads recently...

    as a vba formula it would be:
    Please Login or Register  to view this content.

  13. #13
    Valued Forum Contributor
    Join Date
    11-15-2007
    Location
    England
    MS-Off Ver
    Office Pro Plus 2021
    Posts
    424

    Re: Vlookup giving Wrong Results

    Sorry Martin,

    I didn't think - Sincere Apologies.

  14. #14
    Valued Forum Contributor
    Join Date
    11-15-2007
    Location
    England
    MS-Off Ver
    Office Pro Plus 2021
    Posts
    424

    Re: Vlookup giving Wrong Results

    Thanks yudlugar, that works perfectly. Sorry about the not putting the post on the right forum.

+ 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. COUNTIF giving wrong results
    By Excel_vba in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-29-2013, 04:17 PM
  2. VLOOKUP not giving apt results....
    By lifeisaspreadsheet in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 11-04-2012, 04:36 AM
  3. Vlookup giving wrong answer
    By toclare84 in forum Excel General
    Replies: 5
    Last Post: 08-26-2010, 08:53 AM
  4. Drop Down Box / VLookup not giving results
    By waki01 in forum Excel General
    Replies: 4
    Last Post: 01-08-2009, 05:04 PM
  5. Very large complex workbook is now giving me the wrong results :(
    By S Davis in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 07-17-2006, 04:05 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