VBA to automatically add text to a cell based on another worksheet

kwooden0626

New Member
Joined
Oct 15, 2016
Messages
20
:confused:
Hello,

I'm not familiar with writing VBA code and I want to know if anyone can assist me with writing a code that will automatically add "Yes" to a cell if an employee's name is listed on another worksheet within the same workbook.

I have a worksheet (Sheet 1) that lists all employees for a particular company and another worksheet (Sheet 2) that has names of employees who are qualified as technicians. I receive an updated list weekly for all qualified technicians so I need the VBA to compare both worksheets and enter "Yes" in the Column for "Qualified Technician." There are over 200 names on the Employees worksheet and over 500 names on the Qualified Technicians worksheet so it takes quite sometime to manually compare the two. Also, not all employees on the Technicians worksheet belong to the company that I need to update and the name structure is different as well. My worksheet list the name in three separate columns (Last, First, M.I.); the technicians worksheet is pulled from another departments database and list the name in one column (Last, First, M.I.).

I've created sample worksheets to show the structure of both worksheets. I will appreciate any assistance anyone can provide.

Sheet 1
Sheet%201_zpsmzwks0za.jpg



Sheet 2
Sheet%202_zpsj0zgs717.jpg
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
If U maintain the exact format as shown for both sheets, this would work in Sheet1!E2 (adjust sheet2 range to suit). You can copy the formula down "E" but will have to adjust the sheet2 range for each copied cells. HTH. Dave
Code:
=IF(COUNTIF(Sheet2!A2:A10,A2 & ", " & B2 & " " & C2)>0,"yes","no")
 
Upvote 0
[h=1]NdNoviceHlp,[/h]
Thank you so much. It works exactly the way I needed it to and I can't thank you enough. This code will make my job so much easier now that I don't have to manually scan the two worksheets.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,176
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top