+ Reply to Thread
Results 1 to 9 of 9

Merging two files and delete the non equal lines

  1. #1
    Registered User
    Join Date
    02-04-2016
    Location
    Malmö, Sweden
    MS-Off Ver
    365
    Posts
    6

    Question Merging two files and delete the non equal lines

    I have two Excel files:

    Both files containg two columns:
    File 1: Article Code, Article Name (1800 lines)
    File 2: Article Code, Price (2000 lines)

    The best would be if I can get the prices from File 2 in a third column after article name in File 1 and then all those lines that are not in File 1 compared to File 2, will be left out of File 1.
    The second best is just to get the prices from File 2 in a third column after article name in File 1.

    Is this possible?

  2. #2
    Valued Forum Contributor
    Join Date
    12-28-2014
    Location
    NSW, Australia
    MS-Off Ver
    MS365
    Posts
    604

    Re: Merging two files and delete the non equal lines

    I believe the VLOOKUP function will do exactly what you want.
    Can't give you a formula without a sample sheet to work from, but should be something like:

    For Cell C1 (of File 1) =VLOOKUP(A1,'[File2.xlsx]Sheet1'!$B$1:$C$2000,2,FALSE)

    That assumes that cell A1 (in file 1) contains the Article Code, and that the Article Codes and Prices are in the range B1:C2000 (in file 2).

  3. #3
    Registered User
    Join Date
    02-04-2016
    Location
    Malmö, Sweden
    MS-Off Ver
    365
    Posts
    6

    Re: Merging two files and delete the non equal lines

    Thanx for helping me out!

    Here are two example files of what it can look like.
    I have several articles in my system and then we get new prices from our supplier.
    I need to update the prices in my list but only the articles I have in my system and forget about the rest.


    Example File 1 .xlsx
    Example File 2 .xlsx
    Last edited by MacMelmac; 02-05-2016 at 03:42 AM.

  4. #4
    Forum Expert shukla.ankur281190's Avatar
    Join Date
    05-17-2014
    Location
    Lucknow, India
    MS-Off Ver
    Office 365
    Posts
    3,935

    Re: Merging two files and delete the non equal lines

    Simply

    Try in Example file 1 in C1 cell below formula

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Checkout this link for better understanding VLOOKUP function

    https://www.ablebits.com/office-addi...rial-beginner/
    Last edited by shukla.ankur281190; 02-05-2016 at 03:50 AM.
    If I helped, Don't forget to add reputation (click on the little star ★ at bottom of this post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)

  5. #5
    Registered User
    Join Date
    02-04-2016
    Location
    Malmö, Sweden
    MS-Off Ver
    365
    Posts
    6

    Re: Merging two files and delete the non equal lines

    I get the information pop up (Functionagrument)

  6. #6
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,148

    Re: Merging two files and delete the non equal lines

    I tried the solution from Ankur and it worked successfully with your posted test files.

    Did you change "," to ";" in the formula (as I think this is the general European convention) ?

  7. #7
    Registered User
    Join Date
    02-04-2016
    Location
    Malmö, Sweden
    MS-Off Ver
    365
    Posts
    6

    Re: Merging two files and delete the non equal lines

    Yes, but still the same pop up. Do I have to have both the files open?

  8. #8
    Registered User
    Join Date
    02-04-2016
    Location
    Malmö, Sweden
    MS-Off Ver
    365
    Posts
    6

    Re: Merging two files and delete the non equal lines

    Hmmm, now I get #NAME? in the cell

  9. #9
    Registered User
    Join Date
    02-04-2016
    Location
    Malmö, Sweden
    MS-Off Ver
    365
    Posts
    6

    Re: Merging two files and delete the non equal lines

    Got it! Translation into Swedish:

    =OMFEL(LETARAD(A1;'[Example File 2 .xlsx]Blad1'!A$1:B$19;2;0);"")

    Thanx a million!

+ 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. Need help to auto merge different files and delete sub total rows after merging
    By ec4excel in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-15-2015, 12:12 PM
  2. [SOLVED] Macro neede to open text files from folder and remove all the lines except specific lines
    By genetist in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 10-07-2014, 02:44 AM
  3. Import multiple text files delete rows between lines with File Name
    By coronakyk in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-10-2014, 09:53 PM
  4. [SOLVED] Macro to Delete useless lines, rearrange by dates and skip lines between different days.
    By Tmc2159 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 06-12-2012, 02:15 PM
  5. Delete all files in directory, msgbox list files before delete.
    By randell.graybill in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-01-2010, 09:28 PM
  6. [SOLVED] merging lines
    By Carrie in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 09-06-2005, 07:05 AM
  7. Sum for lines equal to criteria
    By rfhorn in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-28-2005, 09:06 AM

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