+ Reply to Thread
Results 1 to 4 of 4

Separate and align rows from two separate sheets based on a cell value.

  1. #1
    Registered User
    Join Date
    07-14-2012
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    15

    Separate and align rows from two separate sheets based on a cell value.

    Hello and thank you for any assistance you can provide.

    In the attached file, I have two sheets with data: Internal Source Data, and Outside Source Data.

    I have a tab titled Desired Result, which illustrates the end result I'm trying to achieve - which is basically to take the date from the Internal and Outside Source Data sheets, separate and align them based on the Unique ID.

    I have issues using Vlookup or Index/Match, because the amounts of rows for each Unique ID are not always congruent.

    Also, I have a macro (thank you jindon!) which fills in formulas in rows J through L. I can get them to populate in the appropriate areas, but the formulas are returning 0. I'm not sure what I'm missing there.

    Furthermore, is this something that is better handled by a Pivot Table, or some other means?
    Attached Files Attached Files

  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: Separate and align rows from two separate sheets based on a cell value.

    Here's my take on that:
    Please Login or Register  to view this content.
    Note, I've removed the blank rows at the top of the source sheets.
    Attached Files Attached Files
    _________________
    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-14-2012
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Separate and align rows from two separate sheets based on a cell value.

    That is most impressive! A few questions, forgive me:

    Does this code assume that each Unique ID is represented in both sets of data?

    Also, if I were to replace one of the columns with text, will that affect the functionality? I assume if I wanted to add columns to the data sets, I would just add another:

    Please Login or Register  to view this content.
    And then adjust the following to account for the new column:

    Please Login or Register  to view this content.
    Lastly, is there a limit to the amount of rows this will search and match? I assume row counts approaching or exceeding 1000 would take a long time to calculate?

    Thanks again JBeaucaire!

  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: Separate and align rows from two separate sheets based on a cell value.

    The macro assumes all the codes needed exist in Internal Source Data sheet. The Outside data can have fewer data sets. As long as both sets are sorted the way your samples were, it should work even on larger data sets.

    You are correct about the second parameter in the Arrays being the number of columns. But be careful to adjust the SUMIF formulas as well. Currently they are referencing columns 3,4 and 8,9. Those would change if you added columns or moved things around.

    With that much data, adding the SUMIF formulas as we go actually slows down the macro more than needed. So I've updated it to add them at the very end instead. I lengthened the data set to 1000 rows and it's pretty fast, still.

    Please Login or Register  to view this content.
    Attached Files Attached Files

+ 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. [SOLVED] Macro needed to Concatenate data in 2 separate tables of 2 separate sheets
    By 823 in forum Excel Programming / VBA / Macros
    Replies: 22
    Last Post: 02-08-2015, 02:02 PM
  2. Creating separate sheets based on single rows in list?
    By Taxster in forum Excel General
    Replies: 3
    Last Post: 12-16-2014, 04:24 PM
  3. Replies: 3
    Last Post: 01-03-2014, 02:13 AM
  4. Replies: 2
    Last Post: 07-06-2012, 05:31 AM
  5. Replies: 8
    Last Post: 09-18-2011, 05:36 AM
  6. Replies: 4
    Last Post: 11-22-2010, 12:57 PM
  7. Replies: 3
    Last Post: 08-12-2010, 03:45 PM

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