ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Importing data into Excel (https://www.excelbanter.com/excel-programming/331858-importing-data-into-excel.html)

bigshotp

Importing data into Excel
 
Hi,
I wanted to know if Microsoft Excel can import a file into excel and
then
automatically eliminate any duplicate records. For instance, File 1 and File
2 have multiple columns. Both share a common column header:

File 1
A B C D
Row 1 WRNO BN SALT MOLWt
Row 2 12345 A1 NONE 340.15
Row 3 23697 B1 NONE 540


File 2
Columns
A B C D E
Row 1 SMILES WRNO Para IC 50 IC 90
Row 2 C 12345 D6 286.36 552
Row 3 C 12345 W2 90 450
Row 4 C1C 23697 D6 NONE 540

I want to be able to automatically get rid of any duplicate cells and then
combine into File 1 all of the new rows to get the following data:

A B C D E F G
H I
Row 1 WR BN SALT MW SMILES D6 Ic 50 D6 IC 90 W2 Ic 50 W2
Ic 90
Row 2 12345 A1 NONE 340 C 286.36 552 90 450
Row 3 23697 B1 NONE 540 C1C NONE 540

How can I do this automatically? Is there a specific macro command/VB
script that I can use to obtain this output? I need for the script to
compare the data in File 1 against the data in file 2. If a column in FIle 2
is not in file 1, i want it to append that column and data to the file. If
there are duplicates within both files, I want the records to be deleted.
Thank you.

Ponder


keepITcool

Importing data into Excel
 

I'd use a query and let SQL do it for me.

You'll have to learn how to do queries and
a bit of SQL. But you wont need VBA.


--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


bigshotp wrote :

Hi,
I wanted to know if Microsoft Excel can import a file into excel
and then
automatically eliminate any duplicate records. For instance, File 1
and File 2 have multiple columns. Both share a common column header:

File 1
A B C D
Row 1 WRNO BN SALT MOLWt
Row 2 12345 A1 NONE 340.15
Row 3 23697 B1 NONE 540


File 2
Columns
A B C D E
Row 1 SMILES WRNO Para IC 50 IC 90
Row 2 C 12345 D6 286.36 552
Row 3 C 12345 W2 90 450
Row 4 C1C 23697 D6 NONE 540

I want to be able to automatically get rid of any duplicate cells and
then combine into File 1 all of the new rows to get the following
data:

A B C D E F
G H I
Row 1 WR BN SALT MW SMILES D6 Ic 50 D6 IC 90 W2 Ic
50 W2 Ic 90
Row 2 12345 A1 NONE 340 C 286.36 552
90 450 Row 3 23697 B1 NONE 540 C1C NONE 540


How can I do this automatically? Is there a specific macro
command/VB script that I can use to obtain this output? I need for
the script to compare the data in File 1 against the data in file 2.
If a column in FIle 2 is not in file 1, i want it to append that
column and data to the file. If there are duplicates within both
files, I want the records to be deleted. Thank you.

Ponder



All times are GMT +1. The time now is 05:46 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com