3 csv file to one & linking to find unique rows

S

steve1040

All
I have 3 csv files

File1
(Row1=Column header)
Field1 = Year
Field2 = Location
Field3 = Dept
Field4 = Month
Field5 = 1total
Field6 = 2total

File2
(Row1=Column header)
Field1 = Year
Field2 = Location
Field3 = Dept
Field4 = Month
Field5 = 3total


File3
(Row1=Column header)
Field1 = Year
Field2 = Location
Field3 = Dept
Field4 = Month
Field5 = 4total

I would like to output a single file
If
File1.field1=File2.field1 & File2.field1=File3.field1
File1.field2=File2.field2 & File2.field2=File3.field2
File1.field3=File2.field3 & File2.field3=File3.field3
File1.field4=File2.field4 & File2.field4=File3.field4

I guess another approach would be to concatenate the first 4 columns
in each file and then see if the row matches.


then write to new csv output file
(Header Row1=Year,Location,Dept,month)
File1.Field1 = Year
File1.Field2 = Location
File1.Field3 = Dept
File1.Field4 = Month
Field5 = 1total
Field6 = 2total
Field7 = 3total
Field8 = 4total

I hope this makes sense

Thanks
Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top