+ Reply to Thread
Results 1 to 7 of 7

How to get vlookup to work on every line?

  1. #1
    Registered User
    Join Date
    07-25-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    16

    How to get vlookup to work on every line?

    Hi,

    I was trying to reconcile a 3000-rows report using vlookup. Problem is every row that has unmatch PO# the vlookup will shows as NA which is fine but then the row after that got screwed up. So I have to go after every NA rows and fix the formula. It's a PITA! Please see below for example.

    My question is, how do I get vlookup to correctly work on every row? Or is there any other function I can use? Help please!

    Thanks so much!!

    Column A Column B Column C Column D

    01003PO46 $189.98
    01003PO59 $10.41 01003PO59 10.41 -->Vlookup got screwed up on this row because it shows NA on the previous row.
    01004PO42 $180.00
    01004PO55 $40.00 01004PO55 39.98 -->Same problem here
    01005PO34 $70.95
    01006PO32 $140.00
    01006PO44 $40.00 01006PO44 39.98
    01008PO45 $274.95
    01008PO61 $63.91 01008PO61 63.62
    01009PO34 $140.00
    01010PO37 $100.00
    01011PO65 $334.95
    01015PO66 $320.00
    01015PO82 $54.91 01015PO82 54.8
    001016PO43 $82.50 01019PO57 39.98
    01018PO44 $117.13 01020PO52 10.95
    01019PO43 $154.95 02001PO59 39.98
    01019PO57 $40.00 02003PO62 45.81
    01020PO37 $163.92 02004PO61 59.97
    01020PO52 $10.95 02006PO57 70.38
    01021PO36 $100.82 02009PO62 20.82
    01022PO53 $291.90 02012PO74 59.97
    02001PO43 $120.82 02013PO58 240.77
    02001PO59 $40.00 02014PO87 8.79
    02002PO40 $133.62 02015PO60 21.36

  2. #2
    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,933

    Re: How to get vlookup to work on every line?

    Sorry, but without seeing the rest of what you are working with (and what your formula looks like), its hard to offer suggestions

    i would suggest you upload a sample work book, (all sensitive data removed), showing what data you are working with, a few examples of what your expected outcome is, and how you arrived at that
    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

  3. #3
    Registered User
    Join Date
    07-25-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: How to get vlookup to work on every line?

    Here you go, please see the attached. Sorry I never attached any file on here before. Not sure if you can see it. If you could, please look at row 5 for example. I use vlookup in column C to get the amount from column F, refer to PO number from column E) and as you can see vlookup worked on row 3 but on row 4 it shows NA because it couldn't find any data from column E and F, which I understand that.

    But then on row 5, why the function all the sudden didn't work? You can see it has data in colomn E&F (yellow highlight) and so every row after row 4 shows NA.

    Thanks a lot!!!
    Attached Files Attached Files

  4. #4
    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,933

    Re: How to get vlookup to work on every line?

    Try this...
    =VLOOKUP(A2,$E$2:$F$137,2,FALSE)

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

    Re: How to get vlookup to work on every line?

    =VLOOKUP(A2,$E$2:$F$137,2,FALSE) note the $ this anchors the references otherwise your lookup range will move as you fill it down
    "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

  6. #6
    Registered User
    Join Date
    07-25-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: How to get vlookup to work on every line?

    Aha moment! I've been putting in wrong formula..

    tricks are only for kids, right? You guys rock! Thanks a bunch!!

  7. #7
    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,933

    Re: How to get vlookup to work on every line?

    Happy to help and thanks for the feedback

+ 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. A single line of code i cant work out...
    By PhishTaco in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-18-2012, 03:49 AM
  2. Second line of code do not work!!!
    By contaminated in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-04-2011, 04:13 PM
  3. Goal Line in Bar Graph - Can't get it to work
    By bg18461 in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 12-03-2008, 01:37 PM
  4. How do i get Ecel on line? why does IE not work?
    By ameron in forum Excel General
    Replies: 0
    Last Post: 01-26-2006, 04:55 PM
  5. concatenating line decided not to work
    By Papa Jonah in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-18-2005, 10:06 AM

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