Forum Discussion

connor015's avatar
connor015
Copper Contributor
Oct 29, 2019
Solved

If/Then Assistance

Hi ladies/gents, I am looking for an if/then command that will look for matching info and, if at least 2 things match, to put the identifier from the old table's person next to the same person in the...
  • Riny_van_Eekelen's avatar
    Oct 30, 2019

    connor015 

    Based on your question, I have written two bits of VBA code that probably need tweaking to fit your specific worksheet layout. You'll find the code in the attached workbook. I created some sample data to demonstrate how it works. It contains a number of different persons, several called "John", but two of them are born on the same date. There is also a "Jenny" who changed name and mail address and an entirely new person which will, thus, not be found in the "Old" data.

     

    When you match records based on "First name" AND one of "DOB", "Mail" or "Alias", you will not be able to determine which John (with the same birthdate) is which. Therefore, I suggest that you match records based on "First name" AND "DOB" AND one of "Mail" or "Alias". That's in the first bit of code. The other bit of code works on the basis of your original request.

     

    You can press the buttons in the sheet "New" and see what happens. Pressing the lower button will result in both Johns born the same date to point at the last one found in the "Old" data. The top button, however, will separate them correctly.

     

    Look into the code and see if you can get it to work. Maybe, you get inspired to do something different. Perhaps a VBA expert can refine/improve my code, but this is all I could think of for now. Hope it helps!

     

Resources