+ Reply to Thread
Results 1 to 8 of 8

How can I match data fields in two columns on one file with those in another file?

  1. #1
    Registered User
    Join Date
    06-22-2012
    Location
    Toronto
    MS-Off Ver
    Excel 2010
    Posts
    28

    How can I match data fields in two columns on one file with those in another file?

    Hello,

    I have two sheets named as "Atmos" and "Surface" in a single Excel file (attached). What I'd like to do is to copy the data in "Surface Condition" and "Surface Temperature" columns in "Surface" sheet and paste them into the columns in "Atmos" only when their "Station_Name" AND "Observation Time" match, and write "N/A" when there is no matching record. The actual dataset contains nearly half million rows to match and copy from..

    I am not sure if there is a simpler way to do this without having to write a VBA code... Your help on this would be highly appreciated.

    Atmos.JPGsurface.JPG
    Attached Files Attached Files

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,585

    Re: How can I match data fields in two columns on one file with those in another file?

    O2:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Array Entered with Ctrl-Shift-Enter rather than just Enter.


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    06-22-2012
    Location
    Toronto
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: How can I match data fields in two columns on one file with those in another file?

    Thanks TMS!!! yes I tried that but the file often becomes "not responding" as there are more than half million cells to search and choose from... I am wondering if there would be a more efficient way to do this.....

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,585

    Re: How can I match data fields in two columns on one file with those in another file?

    First thought is to add a helper column with just the MATCH part of the formula ... that's the Array part. Then you could have the INDEX formula part use the helper column. That would halve the Array formula calculations. Even better might be to use VBA to drop the MATCH part of the formula into the helper column, say 1000 cells at a time and convert the formulae to values. Then you would have anything like the ongoing calculation. The downside, of course, is that the indexes become static.

    Try the helper column first and see if that helps. Bear in mind that the MATCH is still an Array Formula BUT the INDEXes are not.

    Regards, TMS

  5. #5
    Registered User
    Join Date
    06-22-2012
    Location
    Toronto
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: How can I match data fields in two columns on one file with those in another file?

    Thanks, it does improve the speed. One more question, to reduce the size of the file (and since the two sheets have been merged), I would like to remove "surface" sheet. But as the sheet is linked to the data fields in "Atmos" sheet, I need to copy and paste as number/text. I am not sure what Excel is doing, but the file become "not responding" again... Any idea? Thanks!

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,585

    Re: How can I match data fields in two columns on one file with those in another file?

    Have you tried setting calculation to manual and then copying and pasting the values?

  7. #7
    Registered User
    Join Date
    06-22-2012
    Location
    Toronto
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: How can I match data fields in two columns on one file with those in another file?

    My bad... At first, I thought it was working fine, but figured it was taking way too long.

    Yes, the sample file that I provided contained only about 7000 rows to search, compare, and match. Like I said, I have more than 500,000 rows in both "Atmos" and "Surface" meaning that it has to run 500,0000^2 times... I figured this when I filtered them, I could only see "Dry" as an available option meaning that Excel is still calculating.. At the bottom where it gives status, it is saying "Calculating: (4 Processors: 0%) for about 20 minutes now and my computer is being overheated... Will there be a (more) efficient way to do this (VBA)???
    Thanks!
    Last edited by geomatics; 11-21-2014 at 09:09 PM.

  8. #8
    Registered User
    Join Date
    06-22-2012
    Location
    Toronto
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: How can I match data fields in two columns on one file with those in another file?

    Just so you know... I am using
    HTML Code: 

+ 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. Replies: 4
    Last Post: 03-28-2013, 08:43 AM
  2. Replies: 0
    Last Post: 08-10-2010, 07:00 AM
  3. Import text fields into columns from txt file
    By Pshawn in forum Excel General
    Replies: 3
    Last Post: 01-28-2010, 12:30 PM
  4. Import Text file Fields as Columns in Excel
    By vijay2482 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-12-2009, 11:05 AM
  5. match some fields & write new file
    By Eddy Stan in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-11-2006, 10:50 AM

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