I’m hoping there’s a VBA solution in Excel for this, but honestly, I’ve only just started searching and learning about VBA yesterday.
I’ve got two workbooks, each with one sheet; one has columns A-P (we’ll call it ‘Core’ or wbkcore), and one has columns A-J (we’ll call it ‘Partial’ or wbkpartial). There are various data types in the two workbooks; dates, names, numeric values, dollar amounts, statuses, comments, etc. and there will always be more rows in wbkcore.
There currently exists a long, manual process of copy/pasting a bunch of things into multiple different sheets within the same workbook, conditional formatting to color code the unique cells, sorting by cell color, and then filtering to only include the unique cells.
My task is to find a way to more efficiently identify the rows in wbkcore that are missing from wbkpartial based on whether the values in one column’s cell from each workbook match (we’ll title that column ‘C_Number’). ‘C_Number’ is a 10 digit numeric, but may be formatted as text in wbkpartial by default, and as a number in wbkcore. Ideally, I’d like for those rows to be copy/pasted into a new workbook or worksheet (we’ll call it ‘Missing’ or wbkmissing), but I’ve got to dedupe and filter to only retain the unique entries.
As an example, my most recent wbkcore has 4,020 rows, and wbkpartial has 3,853. In wbkcore, the C_Number values are in column E, and in wbkpartial they’re in column F. By default, the data in both workbooks doesn’t appear to be in any specific order, so it’s possible E400 in wbkcore matches F3000 in wbkpartial.
If wbkcore.E = wbkpartial.F then I’d like to copy/paste the entire row from wbkcore (columns A-P) into a new workbook (wbkmissing). I’m hoping this can loop repeatedly until all of the entries from column E in wbkcore have been searched for in wbkpartial, so in the example above, it would repeat the check for a match from E1 all the way down thru E4020.
The C_Number values are a 10 digit numeric, but may be formatted as text in wbkpartial by default, and as a number in wbkcore.
TLDR: Two workbooks with data. Ask to omit rows where C_Number cell value from wbkcore is also found in a C_Number cell from wbkpartial. Copy/paste into a new workbook (wbkmissing) the entire row of data from wbkcore for all instances where C_Number only exists in wbkcore and not wbkpartial.
I’ve tried searching thru a bunch of other VBA-related asks and replies, but my use case is pretty specific and hard to search for specifically. There were some VBA modules that I found that identified a match, but beyond highlighting the row, I couldn’t figure out how to implement a copy/paste function, new workbook creation, loop feature, etc.
jpWRX is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.