I have the first and last name of criminals in New York during the early 20th C. I have narrowed down the certain sector of crime I'm focusing on, but I want to cross-reference the names with the wider database to see if they have committed any other offences. The problem is, the first name and last name are in different cells. SO, the best I've been able to do so far is mark an 'X' if there is a match for the last name, and an 'X' in the column next to if there is a match for the first name. The problem with this is that while it narrows it down SLIGHTLY, there's lots of people that have the name 'Adam' for example, and lots with the last name 'Brown', so it doesn't show there's actually a match.
So spreadsheet 1 'S1', has a last name (e.g. Brown) in C2 and first name (e.g. John) in D2 while spreadsheet 2 'S2' has totally different names in C2 and D2, so I need to search through all the column of C and then D for a match.
Is there a way of writing a code for this? Any ideas?!
If a custom report is more convenient, the VBA code bellow needs an extra sheet
Assuming that your sheets are "Sheet1" (S1), "Sheet2" (S2), and Sheet3 (the report), the solution will generate on Sheet3 a list with all unique FirstName + LastName from S1 that have a match on S2
Additional functionality:
If you click on any Name (First or Last) on S3 it will filter S1 and S2 for that name, similar to this:
S1
S2
Report (S3)
Clicking on "First3" (or "Last3") in S3, you'll get
S1
S2
The code:
Open VBA editor: Alt+F11
Module1 (total of 4 procedures):
Now, in the VBA editor double-click the item "Sheet3" (top left) to open its module and paste this code
"Sheet3" Module (1 procedure):
To execute the code
FindMatches()
Make sure that all sheets are named exactly "Sheet1", "Sheet2", and "Sheet3"
Hope this helps