+ Reply to Thread
Results 1 to 5 of 5

Merging data files - solved

  1. #1
    Registered User
    Join Date
    01-07-2010
    Location
    Alexandria, VA
    MS-Off Ver
    Excel 2010
    Posts
    5

    Merging data files - solved

    I primarily use SPSS for my stats analysis, but am now working with numerous others who use Excel exclusively. I am somewhat proficient at Excel, but can't seem to figure this probably simple problem out.

    I have a master file with columns of data (the first column being an ID number for the row). I have a second file with completely different columns of data, but that also contains that same ID numbers. I need to merge the files so that each row in the second file matches up with the correct row in the first file (done using the ID column). The problem is that the second file has only a small subset of the IDs (500 rows, compared to 3000 in the first file), so I can't use consolidate (to my knowledge at least). My first goal is merge the second file into the first file to create one large master file. My second, and real goal, is to just merge the necessary columns from the first file into the second file.

    To better explain, a simple example file of what I am dealing with/looking for is attached.
    Attached Files Attached Files
    Last edited by andrewlong; 12-10-2010 at 09:59 AM.

  2. #2
    Registered User
    Join Date
    12-02-2010
    Location
    Huntington, New York, USA
    MS-Off Ver
    Excel 2007
    Posts
    20

    Re: Merging data files

    It sounds as if you want to add the columns from the first file, that match to ID numbers in the second file, to the second file. The VLOOKUP command cna do this either manually on a spreadsheet or automate in a VBA macro. You sill need a VLOOKUP statement for each column to be added. See Excel help for the usage of VLOOKUP. The only tricky part is that you need the ID numbers in the first file to be in column "A".

    Good luck,

    Stosh

  3. #3
    Registered User
    Join Date
    01-07-2010
    Location
    Alexandria, VA
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Merging data files

    thanks, this looks to be an adaquate fix for what I am doing... another quick question, is there a way for VLOOKUP to return a 0 or empty string instead of error text if the VLOOKUP cannot find the value it is looking up (using VLOOKUP in strict mode, of course). I have tried =IF(VLOOKUP(...),VLOOKUP(...),"") thinking the VLOOKUP in the logical test would parse to true if it found something and false if it did not, but that doesn't work.

  4. #4
    Registered User
    Join Date
    12-02-2010
    Location
    Huntington, New York, USA
    MS-Off Ver
    Excel 2007
    Posts
    20

    Re: Merging data files

    Since the syntax for the IFERROR statementis:

    IFERROR(value,value_if_error)

    How about the following:

    IFERROR(VLOOKUP(........,......., etc.),0) for each column you wish to move. That should work.

    Stosh

  5. #5
    Registered User
    Join Date
    01-07-2010
    Location
    Alexandria, VA
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Merging data files

    thanks again, I had no idea that function even existed

+ 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