+ Reply to Thread
Results 1 to 6 of 6

Copying Data Between Sheets

Hybrid View

  1. #1
    Registered User
    Join Date
    02-20-2009
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    7

    Copying Data Between Sheets

    I have two spreadsheets in the same workbook.
    Sheet1 contains statistics for teams and years.
    Sheet2 contains a listing of the teams in different orders.

    How can I have excel copy a teams stats from Sheet1 to Sheet2 as it goes down the row? For example, A1 is atlanta 1996 so it copies a section of atlanta's 1996 stats to a specific range. Then A2 is detroit 2002 so it copies detroit's 2002 stats, and so on and so forth all the way down the list?

    I am a beginner with VBA but I have experience with C/C++. I am just not sure of the functions for excel do all these things automatically and am having trouble finding applicable examples.

    Thanks!
    Last edited by python023; 02-21-2009 at 01:33 AM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Copying Data Between Sheets

    Attaching your own sample with some expected results would help determine the best route.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    02-20-2009
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Copying Data Between Sheets

    Sheet 1
    A B C D
    team year stats1 stats2
    atl 1996 50 51
    det 1998 25 65
    mia 2000 60 44
    mia 2001 12 17



    Sheet 2
    A B C D
    team year stats1 stats2
    det 1998
    atl 1996
    mia 2001

    I want excel to see that the team and year in sheet 2 are detroit 1998 and go to sheet 1 and copy stats1 and stats2 from sheet1 to sheet2. Then it sees the next entry, atl 1996. It finds atlanta's 1996 stats and copies them to sheet 2. So the final output will be:

    Sheet 2
    A B C D
    team year stats1 stats2
    det 1998 25 65
    atl 1996 50 51
    mia 2001 12 17

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Copying Data Between Sheets

    try, In Sheet2!C2:

    =Index(Sheet1!C$2:C$100,Match(1,(Sheet1!$A$1:$A$100=$A2)*(Sheet1!$B$1:$B$100=$B2),0))

    Adjust the ranges to suit your Sheet1 data... and then confirm the formula with CTRL+SHIFT+ENTER not just ENTER. You will see { } brackets appear..

    Then copy the formula to D2 and then copy both formulas down the columns.

  5. #5
    Registered User
    Join Date
    02-18-2009
    Location
    Texas, USA
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Copying Data Between Sheets

    Highlight the cells in sheet 1 that you want to copy to sheet 2. On sheet 2, click on cell where you will paste your formula, then go to Edit in the menu bar up top and select Paste Special. Once you get the pop up window for Paste Special, select Paste Link. Now, everytime you edit your cells in Sheet one, they will change on sheet 2, but only if you did a paste link for them. Hope this helps.

  6. #6
    Registered User
    Join Date
    02-20-2009
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Copying Data Between Sheets

    Quote Originally Posted by nbvc View Post
    try, in sheet2!c2:

    =index(sheet1!c$2:c$100,match(1,(sheet1!$a$1:$a$100=$a2)*(sheet1!$b$1:$b$100=$b2),0))

    adjust the ranges to suit your sheet1 data... And then confirm the formula with ctrl+shift+enter not just enter. You will see { } brackets appear..

    Then copy the formula to d2 and then copy both formulas down the columns.
    thank you so much!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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