Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 1
Default How to combine data files with different fields?

I have three files with data about a set of individuals where each
file has different fields. The largest contains last name, first
name, address and phone with data on about 8,000 names. The second
is a smaller file with last name, first name, address in a different
format, birthday, and region code. Most but not all of the names in
the second file are also in the first file. The third is the smallest
file containing names, address, and two activity code fields. I want
to combine these files to create a single record for each name
containing the fields from all three.

Here is an example of the file when it is simply combined:

Last First Addr1 Addr2 Phone Birth Region Act1 Act2
BB AA 1111 2222
BB BB 1234 3333
BB AA 1111 1988 2
BB AA 1111 2 3
4

I want to get this data to look like this:

Last First Addr1 Addr2 Phone Birth Region Act1 Act2
BB AA 1111 1111 2222 1988 2 3 4
BB BB 1234 3333

Do I have to use VBA? I tried using Access but don't have the skills
to make it work - and I'd rather leave it in excel anyway.
  #2   Report Post  
Posted to microsoft.public.excel.newusers
Max Max is offline
external usenet poster
 
Posts: 9,221
Default How to combine data files with different fields?

Here's one formulas play ..

Illustrated in this sample:
http://www.savefile.com/files/1314960
Extract unique names n combine fields.xls

Assume source data is in a sheet: x,
in cols A to I, data from row2 down

Use 2 empty cols to the right, eg cols J and K
In J2: =IF(COUNTA(A2:B2)<2,"",A2&"_"&B2)
In K2: =IF(J2="","",IF(COUNTIF(J$2:J2,J2)1,"",ROW()))
Leave K1 empty. Select J2:K2, copy down to cover the max expected extent of
source data

Then in another sheet: y,
with the same col headers pasted into A1:I1

In A2:
=IF(ROWS($1:1)COUNT(x!$K:$K),"",INDEX(x!A:A,SMALL (x!$K:$K,ROWS($1:1))))
Copy A2 to B2

In C2, array-entered (press CTRL+SHIFT+ENTER to confirm the formula):
=IF(ISNA(MATCH(1,(x!$A$2:$A$100=$A2)*(x!$B$2:$B$10 0=$B2)*(x!C$2:C$100<""),0)),"",
IF(INDEX(x!C$2:C$100,MATCH(1,(x!$A$2:$A$100=$A2)*( x!$B$2:$B$100=$B2)*(x!C$2:C$100<""),0))=0,"",
INDEX(x!C$2:C$100,MATCH(1,(x!$A$2:$A$100=$A2)*(x!$ B$2:$B$100=$B2)*(x!C$2:C$100<""),0))))
Copy C2 across to I2. Select A2:I2, copy down to the same extent as done in
x's cols J & K, to extract the required results. Cols A and B will return
the unique names while cols C to I will populate the other cols accordingly.
Remember to adapt the ranges in C2's array formula to suit the extent done
in x's cols J & K before copying across.
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"pavil" wrote in message
...
I have three files with data about a set of individuals where each
file has different fields. The largest contains last name, first
name, address and phone with data on about 8,000 names. The second
is a smaller file with last name, first name, address in a different
format, birthday, and region code. Most but not all of the names in
the second file are also in the first file. The third is the smallest
file containing names, address, and two activity code fields. I want
to combine these files to create a single record for each name
containing the fields from all three.

Here is an example of the file when it is simply combined:

Last First Addr1 Addr2 Phone Birth Region Act1 Act2
BB AA 1111 2222
BB BB 1234 3333
BB AA 1111 1988 2
BB AA 1111 2 3
4

I want to get this data to look like this:

Last First Addr1 Addr2 Phone Birth Region Act1 Act2
BB AA 1111 1111 2222 1988 2 3 4
BB BB 1234 3333

Do I have to use VBA? I tried using Access but don't have the skills
to make it work - and I'd rather leave it in excel anyway.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how can I convert data with fields in rows to fields as columns PiyushAg Excel Discussion (Misc queries) 3 July 2nd 07 05:46 AM
combine 2 files into one Calculate Date range Excel Worksheet Functions 3 November 14th 06 02:37 PM
combine worksheets and populate fields punkincmg Excel Discussion (Misc queries) 1 December 1st 05 12:27 AM
combine two files Charles Excel Discussion (Misc queries) 1 August 9th 05 09:46 PM
How to combine dat from 4 fields into one field mdeanda Excel Worksheet Functions 2 May 29th 05 05:24 PM


All times are GMT +1. The time now is 08:36 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"