+ Reply to Thread
Results 1 to 8 of 8

Join 2 worksheets in a 3rd

  1. #1
    Registered User
    Join Date
    07-02-2009
    Location
    the Island of Australia
    MS-Off Ver
    Excel 2003
    Posts
    9

    Join 2 worksheets in a 3rd

    Hi,

    I am trying to consolidate 2 reports into 1. Both sheets have exacly the same heading structure. I want to be able to open the 3 sheets at once and have the 2 existing reports 1 on top of the other in the 3rd spreadsheet.

    If someone could help I would be so greatful this will turn a mundane timeconsuming task into a very quick and easy task.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Join 2 worksheets in a 3rd

    Seems simple enough to do. Post up your workbook and make sure the 3rd sheet is in the layout you want, include any notes about things that aren't the same all the time (like # of rows, # of columns)...whatever hurdles are to be overcome.

    Then click GO ADVANCED and use the paperclip icon to post up your workbook.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    07-02-2009
    Location
    the Island of Australia
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Join 2 worksheets in a 3rd

    Quote Originally Posted by JBeaucaire View Post
    Seems simple enough to do. Post up your workbook and make sure the 3rd sheet is in the layout you want, include any notes about things that aren't the same all the time (like # of rows, # of columns)...whatever hurdles are to be overcome.

    Then click GO ADVANCED and use the paperclip icon to post up your workbook.

    Thank you for you help JBeaucaire, I have attached the 3 spreadsheets as requesetd. I have only left 3 rows of data in each spread sheet and changed the values that they normally are to protect sensitive data but there is normally at least 200 rows of data in each spreadsheet. the number of row in each spreadsheet will vary each time these reports are run.

    Thanks,

    Leviathan185
    Attached Files Attached Files

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Join 2 worksheets in a 3rd

    This master has two helper formulas added in P:Q. With those value, the table will fill itself out with this INDEX formula:

    =IF(ROW()<=$Q$1,INDEX([WorkbookA.xls]Sheet1!A:A,ROW()),INDEX([WorkbookB.xls]Sheet1!A:A,ROW()-$Q$1+1))

    That same formula in A2 is copied down 500 rows and across. It pulls back the values from the other workbooks.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    07-02-2009
    Location
    the Island of Australia
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Join 2 worksheets in a 3rd

    I think I may be doing something wrong? when i put that formula in it will only get the data from WorkbookB.xls?

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Join 2 worksheets in a 3rd

    Did you put in the helper formulas in P1:Q2?

  7. #7
    Registered User
    Join Date
    07-02-2009
    Location
    the Island of Australia
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Join 2 worksheets in a 3rd

    HaHA I am such a R-Tard. yes it work perfectly now. Thank You so much!

    If you wouln't mind i would really like to know how that works so i can learn from that rather that just using it no knowing how it works and possibly implement it in other projects.

    you don't have to though you have been a great help already. Thanks again.

    Leviathan185

  8. #8
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Join 2 worksheets in a 3rd

    You know how to use ROW()? Putting =ROW() in row2 gives an answer of 2. In row4, it equals 4, ok?

    INDEX(Range,2) gives you the 2nd item in the range. So INDEX(A:A,2) gives you the second item in column A.

    If you put this formula in row5: =INDEX(A:A,ROW()), it gives you the 5th item in column 5. Make sense so far? That's all we're doing here.

    In Q1 we are counting how many rows of data there are in WbA. Then we are pulling that many rows of data FROM wbA.
    =IF(ROW()<=$Q$1,INDEX([WorkbookA.xls]Sheet1!A:A,ROW()),INDEX([WorkbookB.xls]Sheet1!A:A,ROW()-$Q$1+1))

    When our formula reaches a row() greater than the number in Q1, it switches to the second formula... =INDEX([WorkbookB.xls]Sheet1!A:A,ROW()-$Q$1+1) This one is a little trickier because we have to convert the first ROW() formula back to a value of 2 since the first thing we want from wbB is the data in row2, right?

    So, let's say Q1 = 4, that means when we get to row5, it switches. Now we don't want to start with row5 in wbB, so ROW() won't work by itself. We have to convert it back to 2. Since we're on row5, and Q1 = 4, we subtract those two numbers, then add 1 to get back to a value of 2. =ROW()-Q1+1 Now, that half of the formula is drawing information back from the second wbB.

    I copies that formula down 500 rows to cover what you said would be about 200 rows in each book. Then copied to the right to fill out the table.

+ 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