Highlighting duplicates between 2 sheets that contain different orderings

crtk09

New Member
Joined
Dec 17, 2021
Messages
16
Office Version
  1. 365
Platform
  1. Windows
Hey all! Any help with this problem I'm bamboozling myself with would be hugely appreciated!

So I have two different sheets I'm looking to compare and highlight duplicates of:
Sheet 1 - Contains all current employee names in a "firstname*space*surname" format. It also contains a " [C]" to indicate Contractors. So, "firstname*space*surname*space*[C]" or vice versa without the "C".
Sheet 2 - Contains a list of employees that have only recorded their time spent working. This list, however, names are formatted between either "firstname*space*surname", "surname.firstname" and "surname*comma*firstname". A very random mix of orderings to work with.

So my question is, I would like to highlight the employees on sheet 1 that are found on sheet 2 (duplicates), however, I'm really struggling to come up with something between conditional formatting and VBA to accomplish this.
Is something like this even possible by asking Excel to essentially search those different variations, ensuring it doesn't "break out" of that naming sequence that sheet 2 contains? (if that makes any sense, lol)

Thank you!
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Random thought that might help this process:
Sheet 2 - Could we somehow tell Excel to somehow reorder those names I mentioned, so that they are corresponding with the ones on sheet 1? Or, find and replace (i.e. delete) the commas, then reorder, if possible.
 
Upvote 0
Welcome to the MrExcel board!

In future, it would help if you can give us some dummy sample data in a form that we can copy/paste to test with. :)
MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.

This sort of text question is often a bit trick, especially if you have multi-word names lime Vincent van Gogh etc. However, see if this Conditional Formatting helps. I have done it on a single sheet but you should be able to adapt to two sheets.

21 12 18.xlsm
ABC
1
2Tom JonesKen Smith
3Tim TimmsHall.Kim
4Kim Hall [C]Jones.Tom
5Ken Smith Baines.Bob
6Ted BaxterDerf,Fred
7Fred Derf
8
CF Dupes
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:A7Expression=COUNT(SEARCH(" "&TRIM(SUBSTITUTE(A2,"[C]",""))&" "," "&SUBSTITUTE(SUBSTITUTE(C$2:C$6&" "&C$2:C$6,"."," "),","," ")&" "))textNO
 
Upvote 0
Welcome to the MrExcel board!

In future, it would help if you can give us some dummy sample data in a form that we can copy/paste to test with. :)
MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.

This sort of text question is often a bit trick, especially if you have multi-word names lime Vincent van Gogh etc. However, see if this Conditional Formatting helps. I have done it on a single sheet but you should be able to adapt to two sheets.

21 12 18.xlsm
ABC
1
2Tom JonesKen Smith
3Tim TimmsHall.Kim
4Kim Hall [C]Jones.Tom
5Ken Smith Baines.Bob
6Ted BaxterDerf,Fred
7Fred Derf
8
CF Dupes
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:A7Expression=COUNT(SEARCH(" "&TRIM(SUBSTITUTE(A2,"[C]",""))&" "," "&SUBSTITUTE(SUBSTITUTE(C$2:C$6&" "&C$2:C$6,"."," "),","," ")&" "))textNO
Hey Peter,

Thank you so much for your reply! My apologies for not including any kind of example / test data, you'll find that below:

Sheet 1:
Copy of Directory_by_Organization_BD_RM_combined_9Dec2021-v2.1.xlsm
ABCDEFGHIJK
1Worker (Workday)Supervisory OrganizationPhoneEmail AddressBusiness TitleLocationManagement ChainDepartment #Department NameWorker TypeCompany
2Aaron SmithSUP5.1 Mary Smith123 456 789test@email.comUK - LondonJames Smith20R&DFTETest Company
3Aashish Rush [C]SUP5.1 Mary Smith124 456 789test@email.comIndia RemoteJames Smith20R&DContractorTest Company
4Aashutosh Polo [C]SUP5.1 Mary Smith125 456 789test@email.comIndia RemoteJames Smith20R&DContractorTest Company
5Muhammad Chavan [C]SUP5.1 Mary Smith126 456 789test@email.comIndia RemoteJames Smith20R&DContractorTest Company
6Abhishek Smith [C]Sup6.5 Tom Jenkins127 456 789test@email.comIndia RemoteJames Smith20SalesContractorTest Company
7Adnan AdnansonSup6.5 Tom Jenkins128 456 789test@email.comUS Remote - ColoradoJames Smith20R&DFTETest Company
8Adriana MichaelsonSup9.5 Mike Toms129 456 789test@email.comToronto, CanadaJames Smith20R&DFTETest Company
9Afsha Ipohm [C]Sup9.5 Mike Toms130 456 789test@email.comIndia RemoteJames Smith20MarketingContractorTest Company
10Afshan Pmiz [C]Sup9.5 Mike Toms131 456 789test@email.comIndia RemoteJames Smith20R&DContractorTest Company
11Aishwarya Bulsamic [C]Sup9.5 Mike Toms132 456 789test@email.comIndia RemoteJames Smith20R&DContractorTest Company
12Rahul SmithSup9.5 Mike Toms132 456 789test@email.comIndia RemoteJames Smith20R&DFTETest Company
13Miriam JonesSup9.5 Mike Toms132 456 789test@email.comIndia RemoteJames Smith20R&DFTETest Company
Sheet1
Cell Formulas
RangeFormula
J2:J13J2=IF(ISNUMBER(SEARCH("[C]",A2)),"Contractor","FTE")


Sheet 2 - The "problem" sheet, per se:
Copy of Directory_by_Organization_BD_RM_combined_9Dec2021-v2.1.xlsm
ABCDEFGH
1AuthorSummaryWork descriptionIssueProjectStartedTime spent secondsTime spent
2Aaron SmithFixed issueSoftware operationalXD-123Super Server V12021-12-17T15:39:31.092+000060010m
3Polo, AashutoshFixed issueBugs squashedXD-124Super Server V22021-12-16T15:12:09.249+0000180030m
4Muhammad ChavanFixed issueServer operationalXD-125Super Server V32021-12-15T14:51:00.000+00003005m
5Abhishek SmithFixed issueSoftware operationalXD-126Super Server V42021-12-15T14:09:18.892+000060010m
6Adnanson, Adnan Fixed issueBugs squashedXD-127Super Server V52021-12-17T15:39:31.092+000145010m
7Michaelson, AdrianaFixed issueServer operationalXD-128Super Server V62021-12-16T15:12:09.249+000130030m
8Afsha IpohmFixed issueSoftware operationalXD-129Super Server V72021-12-15T14:51:00.000+00011505m
9Afshan PmizFixed issueBugs squashedXD-130Super Server V82021-12-15T14:09:18.892+000120010m
10Aishwarya BulsamicFixed issueServer operationalXD-131Super Server V92021-12-17T15:39:31.092+000230010m
11Rush, AashishFixed issueSoftware operationalXD-132Super Server V102021-12-16T15:12:09.249+000250030m
12Rahul Michael SmithFixed issueBugs squashedXD-133Super Server V112021-12-15T14:51:00.000+00024505m
13Jones, Miriam WilliamsFixed issueServer operationalXD-134Super Server V122021-12-15T14:09:18.892+000260010m
Sheet2


Hope this gives anyone a good idea of what we're dealing with here! Quite a finicky mess of naming combinations across these two sheets.
 
Upvote 0
Welcome to the MrExcel board!

In future, it would help if you can give us some dummy sample data in a form that we can copy/paste to test with. :)
MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.

This sort of text question is often a bit trick, especially if you have multi-word names lime Vincent van Gogh etc. However, see if this Conditional Formatting helps. I have done it on a single sheet but you should be able to adapt to two sheets.

21 12 18.xlsm
ABC
1
2Tom JonesKen Smith
3Tim TimmsHall.Kim
4Kim Hall [C]Jones.Tom
5Ken Smith Baines.Bob
6Ted BaxterDerf,Fred
7Fred Derf
8
CF Dupes
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:A7Expression=COUNT(SEARCH(" "&TRIM(SUBSTITUTE(A2,"[C]",""))&" "," "&SUBSTITUTE(SUBSTITUTE(C$2:C$6&" "&C$2:C$6,"."," "),","," ")&" "))textNO
Hi again, Peter,

Just wanted to follow up and say after some testing, the formula you provided with your response actually seems to be working for me!! I've got the two list names side by side currently and it appears to be highlighted as it should be, so thank you!

Now my question is, how do I re-work the formula so that it communicates between my two sheets? I haven't done much cross-sheet-conditional formatting before...
 
Upvote 0
how do I re-work the formula so that it communicates between my two sheets?
You will need to adjust for your sheet names and ranges, but the gist of it is this.

crtk09.xlsm
A
1
2Ken Smith
3Hall.Kim
4Jones.Tom
5Baines.Bob
6Derf,Fred
7
Sheet5


crtk09.xlsm
A
1
2Tom Jones
3Tim Timms
4Kim Hall [C]
5Ken Smith
6Ted Baxter
7Fred Derf
8
CF Dupes
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:A7Expression=COUNT(SEARCH(" "&TRIM(SUBSTITUTE(A2,"[C]",""))&" "," "&SUBSTITUTE(SUBSTITUTE(Sheet5!A$2:A$6&" "&Sheet5!A$2:A$6,"."," "),","," ")&" "))textNO



Sheet 2 - Contains a list of employees that have only recorded their time spent working. This list, however, names are formatted between either "firstname*space*surname", "surname.firstname" and "surname*comma*firstname".
I note that with your samples provided in post #4 there are even more variations than you have listed here. ;)
Therefore my formula will not match some names that probably should be matched (eg Adnan Adnanson)
 
Upvote 0
Solution
You will need to adjust for your sheet names and ranges, but the gist of it is this.

crtk09.xlsm
A
1
2Ken Smith
3Hall.Kim
4Jones.Tom
5Baines.Bob
6Derf,Fred
7
Sheet5


crtk09.xlsm
A
1
2Tom Jones
3Tim Timms
4Kim Hall [C]
5Ken Smith
6Ted Baxter
7Fred Derf
8
CF Dupes
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:A7Expression=COUNT(SEARCH(" "&TRIM(SUBSTITUTE(A2,"[C]",""))&" "," "&SUBSTITUTE(SUBSTITUTE(Sheet5!A$2:A$6&" "&Sheet5!A$2:A$6,"."," "),","," ")&" "))textNO




I note that with your samples provided in post #4 there are even more variations than you have listed here. ;)
Therefore my formula will not match some names that probably should be matched (eg Adnan Adnanson)
Oh, haha! Those were total dummy names I made up on the spot at the confidentiality of the employees actually listed on these sheets. Probably could've come up with a more creative one than "Adnan Adnanson", lol.

Anyway, thank you so much again for the revised formula! I implemented it earlier and have been testing the highlighted and non-highlighted names against the data it's comparing to, and so far I've got a 100% accuracy rate! I'm going to continue working my way through just to be sure, or until I lose my mind manually checking 500 names, but so far, so good!
 
Upvote 0

Forum statistics

Threads
1,223,157
Messages
6,170,420
Members
452,325
Latest member
BlahQz

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