+ Reply to Thread
Results 1 to 11 of 11

VLookup of two columns to return a result.

Hybrid View

  1. #1
    Registered User
    Join Date
    10-03-2012
    Location
    Tampa
    MS-Off Ver
    Excel 2010
    Posts
    13

    VLookup of two columns to return a result.

    Hi Everyone,

    I know this is simple, but VLookups drive me insane for some reason. Basically, I have two sets of data from two different databases. I would like to compare the product count of similar parts to see if they match. If the counts do not match return "No" and if counts match return a "Yes", if a serial number is missing from one set of data return "Missing" Below is a few lines of the columns.


    A1 B1 C1 D1 E1 F1 H1 I1 J1 K1 L1 M1
    1158 OIL 1 TampaACF 156 156 1503-0337-00 INLET 1 1 A300A Yes
    1312 32CFM 1 TampaACF 983.48 983.48 1613 6105 90 OIL 1 1 A300E Yes
    1352 ELEMENT 1 TampaACF 310.5 310.5 1614 8747 99 OIL 1 1 A300E Missing
    3697 85CFM 1 TampaACF 1637.6 1637.6 1619 2797 00 AIR 1 1 A300C No
    ......
    ......

    In my example above I need to find items with the matching part numbers between (A1:H1) and compare the counts in (C1:J1) and return count "Yes", "No" or "Missing" The data H1 is the key to trigger the missing return. Since the spaces are removed the above needs to be added to a spreadsheet for clarity.


    Everyone has been great on this forum and I hope I can get more great support.

    Thank you...
    Last edited by ACFHogan; 05-23-2013 at 09:10 AM. Reason: spaces removed in post.

  2. #2
    Registered User
    Join Date
    07-06-2012
    Location
    NY
    MS-Off Ver
    Excel 2007
    Posts
    38

    Re: VLookup of two columns to return a result.

    Please attached a sample sheet so we can have a better idea of what it looks like.
    You can do so by going to the "Go Advanced" button next to Post quick reply.

  3. #3
    Registered User
    Join Date
    10-03-2012
    Location
    Tampa
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: VLookup of two columns to return a result.

    File is attached thanks...
    Attached Files Attached Files

  4. #4
    Valued Forum Contributor
    Join Date
    04-13-2011
    Location
    Ottawa, Canada
    MS-Off Ver
    365
    Posts
    1,101

    Re: VLookup of two columns to return a result.

    I still don't get how you'd like to compare...on what basis? I didn't see any similarity on your file between column A and column H. Also, how'd you determine if it's 'Yes', 'No' or 'Missing'

  5. #5
    Registered User
    Join Date
    10-03-2012
    Location
    Tampa
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: VLookup of two columns to return a result.

    Two different column header names for the same items (pulled from different databases so column headers are different). invntryitm_id (A1) = IF_PART (H1), QtyOnHand (C1) = IF_PHYS_CNT (J1). Looking up parts numbers from each database and when they match comparing the quantity on hand to see if the quantities are the same in both databases. The missing is to see if parts are missing in one database.

  6. #6
    Valued Forum Contributor
    Join Date
    04-13-2011
    Location
    Ottawa, Canada
    MS-Off Ver
    365
    Posts
    1,101

    Re: VLookup of two columns to return a result.

    This is what I meant ACFHogan!!

    In cell A1 where you have 1158, no matter where I look at column H, there's no 1158 at all anywhere in the fields. Yet, on your above example, you have it under 'YES', instead of 'MISSING'.

    If my logic is correct, then the attached file that you've given, it should all be 'MISSING'

  7. #7
    Registered User
    Join Date
    10-03-2012
    Location
    Tampa
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: VLookup of two columns to return a result.

    So sorry for the confusion. There are 20,000 records, I meant the ..... to indicate that thousand of records follow and the ones that said 'Yes' had matching parts numbers and count numbers. The ones that have matching part numbers, but the count numbers are different said "No" and the part numbers that do not have a match said "missing" The above was a representation of the return of 20,000 records. I know that there are more part numbers in the H1 column which was returned from a second database, so hundreds of part numbers are missing in the first database. The counts in the first database should match the second but don't. The idea is to fix our inventory in the first database by finding the differences between the two databases (second database is the most accurate) and doing physical counts.

  8. #8
    Valued Forum Contributor
    Join Date
    04-13-2011
    Location
    Ottawa, Canada
    MS-Off Ver
    365
    Posts
    1,101

    Re: VLookup of two columns to return a result.

    I think it's best that you give a few samples that have the ones that were 'Yes', 'No' and 'Missing'.

    This way, we can actually know how your file looks like. Rather than blindly "assume" your file looks like how you've given to us in the first attachment.

    You mention of 1st and 2nd database. I'm assuming that the 1st database is from Column A to Column F and 2nd database is from Column H to Column L? Since you're only doing a vlookup from 1 to another, which one has the most/complete data. Which file/database you'd like to see 'Yes', 'No' and 'Missing'?

  9. #9
    Registered User
    Join Date
    10-03-2012
    Location
    Tampa
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: VLookup of two columns to return a result.

    Did what I could with the spreadsheet to make it easier to understand. The VLOOKUP formula in G: is shown below. As you can see in the example I am returning the count from B: and get #N/A for non-matching part numbers. with proper labeling I will be a sort better.

    =VLOOKUP(E3, $A$1:$B$1300, 2, FALSE)
    Attached Files Attached Files

  10. #10
    Valued Forum Contributor
    Join Date
    04-13-2011
    Location
    Ottawa, Canada
    MS-Off Ver
    365
    Posts
    1,101

    Re: VLookup of two columns to return a result.

    Put this formula on cell G2 and copy down and see if it's what you're looking for.

    =IF(ISERROR(VLOOKUP($E2,$A$2:$B$19,2,0))=TRUE, "Missing", IF(VLOOKUP($E2,$A$2:$B$19,2,0)=$F2, "Yes", IF(VLOOKUP($E2,$A$2:$B$19,2,0)<>$F2, "No", "Incomplete formula")))

  11. #11
    Registered User
    Join Date
    10-03-2012
    Location
    Tampa
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: VLookup of two columns to return a result.

    Thanks a lot. I really appreciate your diligence in helping. Wished I could have explained it better. You're the best!
    Last edited by ACFHogan; 05-23-2013 at 01:15 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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