+ Reply to Thread
Results 1 to 13 of 13

Comparing Two Tables

  1. #1
    Registered User
    Join Date
    06-10-2008
    Posts
    4

    Comparing Two Tables

    I have one .xls file that contains an inventory list of all the products that I want. Unfortunately this .xls file does not contain the prices for these items. I have another .xls file that contains SKU numbers and the prices related to those SKU numbers.

    Is there a way to run every single SKU in the first file against the second file and, when a match is found, take the entry in the price column of the second file and place it in the first file so that my first .xls file contains all my products with prices?

    I included sample data.
    Attached Files Attached Files
    Last edited by Xantar; 06-10-2008 at 04:23 PM.

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582
    I think what you want is VLOOKUP. Attached is an example. In file SKU1, the prices exist, in SKU2, they are "looked up." The IF statement checks first to see if there is a match (SKU vs SKU) and if not, it returns "No Price" If there is a match, it does the vlookup.

    ChemistB
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    06-10-2008
    Posts
    4
    My SKU1.xls file is an edited file that contains only the wine entries for our store. My SKU2.xls file is a pricing file that contains prices for every item in the entire store, so SKU1 has 4300 rows and SKU2 has 10,000. Would this still work?

  4. #4
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582
    Yes, for example in the price column of SKU1 (assuming starting in row 2)
    Please Login or Register  to view this content.
    and drag down for 4300 rows.

    ChemistB

  5. #5
    Registered User
    Join Date
    06-10-2008
    Posts
    4
    I tried that and it gave me a No Value designation. Attached are cut versions of my SKU1 and SKU2 files. Perhaps I'm putting it in wrong?

    Of course since SKU2 is edited you won't be able to get an answer out of it, but you'll be able to see what format my files are in.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    06-04-2008
    Posts
    10

    Smile Vlookup relies on table being sorted

    You need to have the price sheet sorted, vlookup should then work in sheet1

  7. #7
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582
    If you're using the FALSE argument as your fourth arg in the VLOOKUP, it shouldn't need to be sorted since each SKU is unique. I'll look at this today and see if I can find out why it's not working.

    ChemistB

  8. #8
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582
    None of the SKU's in Sku1 are in Sku2. Is that simply because you removed a bunch or is there something I'm missing?

    ChemistB

  9. #9
    Registered User
    Join Date
    06-04-2008
    Posts
    10

    Vlookup must use sorted table

    "by default a table must be sorted in ascending order" its in the help for vlookup

  10. #10
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582
    From the Excel help
    If range_lookup is TRUE, the values in the first column of table_array must be placed in ascending order: ..., -2, -1, 0, 1, 2, ..., A-Z, FALSE, TRUE; otherwise VLOOKUP may not give the correct value. If range_lookup is FALSE, table_array does not need to be sorted.
    Try it.

    ChemistB

  11. #11
    Registered User
    Join Date
    06-10-2008
    Posts
    4
    http://xantar.cookiethievery.com/SKU1.xls

    http://xantar.cookiethievery.com/SKU2.xls

    SKU1 contains SKU numbers and names of products. SKU2 contains SKU numbers and prices.

    These are the REAL files, so let me know if you guys can figure this out. Nothing works for me (mostly because I'm doing it wrong!)

  12. #12
    Registered User
    Join Date
    06-24-2008
    Posts
    1
    You need to use an index and match, try this formula in column C of SKU1
    =INDEX([SKU2.xls]prc.xls!$A:$C,MATCH(A2,[SKU2.xls]prc.xls!$A:$A,0),3)

  13. #13
    Registered User
    Join Date
    06-04-2008
    Posts
    10

    follow this as a guide

    use your data as I had to cut down for size to post
    Attached Files Attached Files

+ 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