+ Reply to Thread
Results 1 to 4 of 4

If else loop to search data and copy it between workbooks

  1. #1
    Registered User
    Join Date
    08-04-2009
    Location
    Banna Republic
    MS-Off Ver
    Excel 2007
    Posts
    2

    If else loop to search data and copy it between workbooks

    Hi all, What I need is a program that takes the data in column 2 of one workbook, searches for it in column 2 of another workbook, and then once it finds a match, goes over one column to column 1, copies the data in column one, and pastes it into column 1 of the other workbook. After this, the program would need to drop down to the next row and repeat. My data set looks like what I've recreated below, but is obviously much much larger. If anyone has any better ideas as to how I can do this, or could show me how I would need to script this I would really appreciate it, I don't know very much about programming and this problem has me absolutely stymied. Thanks for all your help! - Ben





    WB1 Column1_____Column2_____Wb2Column1_____ Column2
    Dell ____________Mary____________ Blank ____________ Jane
    Dell ____________Mary____________Blank ____________ Mary
    Dell____________Jane____________ Blank ____________ Bob
    Gm ____________Bob ____________ Blank____________ Mary
    Gm ____________Bob ____________ Blank____________Bob
    Hoover _________Paul__________ Blank __________ Paul

    (The idea being to copy and paste the appropriate field from WB1 Column1 into Wb2 Column1. In WB1 Jane works for Dell, so in WB2 it would need to copy "Dell" into the field currently labeled "blank")
    Last edited by exc; 08-04-2009 at 01:52 PM.

  2. #2
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: If else loop to search data and copy it between workbooks

    Ben - I suggest you attach a sample workbook which illustrates how all your data are laid out and the results you want.

  3. #3
    Registered User
    Join Date
    08-04-2009
    Location
    Banna Republic
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: If else loop to search data and copy it between workbooks

    Here it is, I put the data that is actually in a second workbook on page two of the workbook I'm uploading
    Attached Files Attached Files

  4. #4
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: If else loop to search data and copy it between workbooks

    Can't you just use VLOOKUP?

    =VLOOKUP(A2,'Workbook One'!$A$2:$B$6,2,FALSE)

    References will be different for your actual data as you have separate workbooks, but just open them both and refer directly to the other file.

+ 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