Hello,
I am new to VBA and I have been having a heck of a time figuring out this problem:
I have information from two databases that need a way to correspond to each other.
The info from each database is listed on its own sheet:
On Sheet1:
Column A: List of Project Numbers from Database 1 (correspond in no way to the Project Numbers from Database 2).
Column B: List of corresponding Investigators in charge of the Projects (each Investigator has multiple projects).
Column C: List of corresponding Project Titles.
On Sheet2:
Column A: List of Project Numbers from Database 2 (correspond in no way to the Project Numbers from Database 1).
Column B: List of corresponding Investigators for the Projects (each Investigator has multiple projects).
Column C: List of corresponding Project Titles.
Column D: Strings extracted from middle of Titles listed in Column C.
I am planning on merging these to databases together, in order to do this I will have to match the Project Numbers on Sheet2 to the Projects listed on Sheet1.
Ordinarily, when I do something like this I would just use a vlookup between the two sets of Project Titles in order to determine the appropriate Project Numbers. However, because these two Databases were created somewhat independently, most of the project titles are slightly different (someone has added text to either the end or beginning of a given Project Title). What I have done is extracted a string in the middle of the Title listed in Sheet2, Column C and placed it in Column D of the same sheet.
So, what I have been trying to do is write a VBA function that will use the instr function that will search for the instance of the string listed in Sheet2, Column D within Sheet1, Column C by looping through its entire range. When a match is found it will then make sure that the corresponding Investigator listed in Sheet2, Column B for the Project matches the Investigator listed for the Project in Sheet1, Column B. If both these conditions are true then the appropriate Project Number listed on Sheet2, Column A will be placed in Column D of Sheet1.
Sorry, that was quite a mouthful, this is my first time posting a question so please let me know if you have any questions about my post. Thanks so for in advance for your help!
Bookmarks