String Finding

CMDRCentral_Max

New Member
Joined
May 30, 2024
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hello,

I have a workbook with two sheets.
Sheet one consists of two columns (A & B), and extends to row 12,088.
Column A is a list of strings in English, Column B is the text in column A but in French.

Sheet two consists of three columns (A, B, C) and extends to row 104,629.
Column A contains the type of content, Column B has the content I need to search within, Column C is the part number related to the content in Column B.

I'm trying to find the best way to search for the string in Sheet1-ColumnA within Sheet2-ColumnB and marking the part number in column C when a match has been found.
 

Attachments

  • English-French 1.jpg
    English-French 1.jpg
    237.9 KB · Views: 18
  • English-French 2.jpg
    English-French 2.jpg
    189.5 KB · Views: 19

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
If I understood your question correctly, try this. I did not put on different worksheets, but you should be able to use this as a guide.

Book1
ABCDEFG
1ENGLISHFRENCHmatchCONTENTCONTENT SEARCHPART NBR
2ENGLISH1FRENCH1MatchENGLISH4PART_NBR127
3ENGLISH2FRENCH2No MatchENGLISH14PART_NBR580
4ENGLISH3FRENCH3MatchENGLISH7PART_NBR978
5ENGLISH4FRENCH4MatchENGLISH6PART_NBR289
6ENGLISH5FRENCH5No MatchENGLISH12PART_NBR538
7ENGLISH6FRENCH6MatchENGLISH8PART_NBR810
8ENGLISH7FRENCH7MatchENGLISH3PART_NBR692
9ENGLISH8FRENCH8MatchENGLISH1PART_NBR515
Sheet6
Cell Formulas
RangeFormula
C2:C9C2=IF(ISNUMBER(MATCH(A2,$F$2:$F$9,0)),"Match","No Match")



Or if you want to lookup into sheet A, and get an indicator:

Book1
ABCDEFGH
12ENGLISHFRENCHCONTENTCONTENT SEARCHPART NBR
13ENGLISH1FRENCH1ENGLISH4PART_NBR127TRUE
14ENGLISH2FRENCH2ENGLISH14PART_NBR580FALSE
15ENGLISH3FRENCH3ENGLISH7PART_NBR978TRUE
16ENGLISH4FRENCH4ENGLISH6PART_NBR289TRUE
17ENGLISH5FRENCH5ENGLISH12PART_NBR538FALSE
18ENGLISH6FRENCH6ENGLISH8PART_NBR810TRUE
19ENGLISH7FRENCH7ENGLISH3PART_NBR692TRUE
20ENGLISH8FRENCH8ENGLISH1PART_NBR515TRUE
Sheet6
Cell Formulas
RangeFormula
H13:H20H13=ISNUMBER(MATCH(F13,$A$13:$A$20,0))
 
Last edited:
Upvote 0
@CMDRCentral_Max
you can try this code
VBA Code:
Sub test()
Dim c As Range, fn As Range
    With Sheets("sheet1") 'change sheet name
        For Each c In .Range("A2", .Cells(Rows.Count, 1).End(xlUp))
            Set fn = Sheets("sheet2").Range("B:B").Find(c.Value, , xlValues, xlWhole)'change sheet name
                If Not fn Is Nothing Then
                     fn.Offset(, 1).Interior.Color = RGB(0, 255, 0)
                   End If
Next
End With
End Sub
the code matches column A in sheet1 with column B in sheet2 and highlight by green the part number in column C if it's matched
I hope this help.
 
Upvote 0
@CMDRCentral_Max
you can try this code
VBA Code:
Sub test()
Dim c As Range, fn As Range
    With Sheets("sheet1") 'change sheet name
        For Each c In .Range("A2", .Cells(Rows.Count, 1).End(xlUp))
            Set fn = Sheets("sheet2").Range("B:B").Find(c.Value, , xlValues, xlWhole)'change sheet name
                If Not fn Is Nothing Then
                     fn.Offset(, 1).Interior.Color = RGB(0, 255, 0)
                   End If
Next
End With
End Sub
the code matches column A in sheet1 with column B in sheet2 and highlight by green the part number in column C if it's matched
I hope this help.
Hello @abdelfattah,

Thank you for this, I've added this to my sheet and updated the sheet names in the vb code. Unfortunately I get a "Type Mismatch" error after the Macro runs for a bit.
Do you by chance have any suggestions?
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,241
Members
452,622
Latest member
Laura_PinksBTHFT

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