Hey all... I'm still a bit of a novice when it comes to Excel's newest dynamic functions, so I'm sure there's an answer here I just haven't figured out yet.
I have two worksheets of similar, but not exactly, structured data. My goal is to combine the data into a single "consolidated" worksheet and, ultimately, to pluck certain columns from each of the source worksheets to form this "child" table.
I've put together a simple example in the attached spreadhseet.
Note that in the 2022 and 2023 tables the data is structured the same, albeit with different #s of rows. Evan Brown appears in both tables. The goal is merge these tables into one, but have no duplicates ... and then sort them in a particular order. SORT(UNIQUE(VSTACK( does this perfectly. That's Example #1.
But in Example #2, the data isn't quite the same ... the 2023 table doesn't include any badge data, so even though Mr. Brown is in both tables, his entire record is not the same in 2022 and 2023. VSTACK still works, but UNIQUE is considering the entire record, and thus duplicates Mr. Brown.
QUESTION #1 -- How to get UNIQUE to consider column 1 (Name) only.
In Example 3, we get close to my true data set, in that the two parent tables are structured differently. While they share two columns, they each have a unique column. Still needing to combine these two tables here, but VSTACK isn't going to do in anymore, as it puts "Committee Room" from 2023 in the same column as "Badge #" from 2022.
QUESTION #2 -- How do you combine data from two tables with different structures?
If Question #1 can be answered successfully, then one approach is to manually restructure the data in the parent tables so it has the same structure, and then use VSTACK to pull it to a consolidated table. But not having to take this step would be preferable.
The reason I liked VSTACK to pull the entire table is the ability to sort off of another column other than the primary (in this case the primary column is Name, but we are sorting on Badge#). If we VSTACK just name and then use formulas to bring over the other data, this gets around the structure isssue, but causes problems sorting the VSTACK array by anything other than itself. So, final question...
QUESTION #3 -- How do you sort a table sourced from tables with different structures, especially when the primary key is an array?
This is Example 4, where VSTACK is used only to pull the Name and subsequent columns are pulled with formulas. But this requires that the lookup formula either a) be in hierarchal order when the data exists in both tables (column "Name") or point only to the specific parent table when the data doe not (columns "Badge #" and "Committee Room"), which isn't particular consistent or simple. And the only way I can sort it (AFAIK) is within the array itself (Name) which isn't the goal. Although I tried SORTBY vs. SORT, I could not come up with a way to get it to sort correctly. (In this simple example, getting it to sort by badge # and putting all the blanks at the beginning or end would suffice).
Many thanks!
Bookmarks