Filter column based on partial match from another column

chive90

Board Regular
Joined
May 3, 2023
Messages
56
Office Version
  1. 2016
Sheet1 Column A I have thousands of ID numbers

Sheet2 Column A these ID numbers exist as part of a much larger string

I require Sheet2 Column A to filter where any of these ID numbers have been found, regardless of where they are in the string.

Tried using advanced filter but I believe it requires an exact match.

Is there another filtering solution or formula I can use to achieve this?

Thank you
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Or, if filtering is not possible, a search which then returns a yes/no if found?

e.g. in Sheet2 Column B can I enter a formula which searches whether A2 contains any of the ID numbers captured in Sheet1 A:A in any part of its string? If it does return Yes, if it doesn't return No? Example data:

Sheet1 Column A:

20578950
45045645
54087780
54064135
98978078

Sheet2 Columns A and B:

shjdshdj/ksjdksa/54064135/djashjdk/ksjljk.comYes
jkhsakjdhslakd/kjksajdk/djksjdksa.comNo
ioqiuieur/dskjdka/dskjdkas/98978078/dksajdksa/jdkajsdklsa.comYes
wewjhejwhe/dskdjsak.comNo
dsdsadsadsjrkj/45045645/popowqeqwYes

This would also work if filtering is not possible. Thanks
 
Upvote 0
Someone else might be able to help you with a formula since you don't have access to MS 365.
If you want to pursue the Advanced filter you just need to use a helper column.
The helper column must have the same column heading as the heading for the equivalent column in the data being filtered.

Sheet 1 - Criteria
Book3
AB
1IDText
220578950*20578950*
345045645*45045645*
454087780*54087780*
554064135*54064135*
698978078*98978078*
Sheet1
Cell Formulas
RangeFormula
B2:B6B2="*"&A2&"*"


Sheet 2 - data to be filtered
Book3
AB
1TextYN
2shjdshdj/ksjdksa/54064135/djashjdk/ksjljk.comYes
3jkhsakjdhslakd/kjksajdk/djksjdksa.comNo
4ioqiuieur/dskjdka/dskjdkas/98978078/dksajdksa/jdkajsdklsa.comYes
5wewjhejwhe/dskdjsak.comNo
6dsdsadsadsjrkj/45045645/popowqeqwYes
Sheet2


Filter set up includes heading row:
1725976340112.png
 
Upvote 0
As an option
16605_Выделение_числа_из_текста.xls
AB
1shjdshdj/ksjdksa/54064135/djashjdk/ksjljk.comYes
2jkhsakjdhslakd/kjksajdk/djksjdksa.comNo
3ioqiuieur/dskjdka/dskjdkas/98978078/dksajdksa/jdkajsdklsa.comYes
4wewjhejwhe/dskdjsak.comNo
5dsdsadsadsjrkj/45045645/popowqeqwYes
Sheet2
Cell Formulas
RangeFormula
B1:B5B1=IF(COUNT(FIND(Sheet1!$A$1:$A$5,$A1))>0,"Yes","No")
 
Upvote 0
Someone else might be able to help you with a formula since you don't have access to MS 365.
If you want to pursue the Advanced filter you just need to use a helper column.
The helper column must have the same column heading as the heading for the equivalent column in the data being filtered.

Sheet 1 - Criteria
Book3
AB
1IDText
220578950*20578950*
345045645*45045645*
454087780*54087780*
554064135*54064135*
698978078*98978078*
Sheet1
Cell Formulas
RangeFormula
B2:B6B2="*"&A2&"*"


Sheet 2 - data to be filtered
Book3
AB
1TextYN
2shjdshdj/ksjdksa/54064135/djashjdk/ksjljk.comYes
3jkhsakjdhslakd/kjksajdk/djksjdksa.comNo
4ioqiuieur/dskjdka/dskjdkas/98978078/dksajdksa/jdkajsdklsa.comYes
5wewjhejwhe/dskdjsak.comNo
6dsdsadsadsjrkj/45045645/popowqeqwYes
Sheet2


Filter set up includes heading row:
View attachment 116679

Thank you. I did try this earlier without the * either side and it did not work.
Is the * either side just some sort of wildcard which essentially says look for the number regardless of any text either side of it?

With the * either side of the number, it appears to be filtering correctly - thank you very much!

It would be great however if I could validate the accuracy of the filter with a formula for example using the below method however this does not appear to be working.

As an option
16605_Выделение_числа_из_текста.xls
AB
1shjdshdj/ksjdksa/54064135/djashjdk/ksjljk.comYes
2jkhsakjdhslakd/kjksajdk/djksjdksa.comNo
3ioqiuieur/dskjdka/dskjdkas/98978078/dksajdksa/jdkajsdklsa.comYes
4wewjhejwhe/dskdjsak.comNo
5dsdsadsadsjrkj/45045645/popowqeqwYes
Sheet2
Cell Formulas
RangeFormula
B1:B5B1=IF(COUNT(FIND(Sheet1!$A$1:$A$5,$A1))>0,"Yes","No")

Thanks for posting. I have tried this but it does not appear to work.

I tested over 10 rows in Sheet2, with row 8 being the only one that contains a number located within the range of Column A Sheet1, but it still returns "No".

The number is captured mid string, e.g. sdjsajdklsad/dsjkjdakas/sjkadjklsd/20000130/djkldjlksa/djkdlajdks/

This number is also captured on row 12 of Sheet1, column A.
 
Upvote 0
Did you substitute your range or the one I gave? The formula I gave looks for numbers regardless of where they are.
Can you show the formula for line 12 where there are numbers?
 
Upvote 0
Did you substitute your range or the one I gave? The formula I gave looks for numbers regardless of where they are.
Can you show the formula for line 12 where there are numbers?

I substituted in my range.

C8 of Sheet2 = ioqiuieur/dskjdka/dskjdkas/98978078/dksajdksa/jdkajsdklsa/
D8 of Sheet2 = =IF(COUNT(FIND(Sheet1!$A$2:$A$2000,$C8))>0,"Yes","No")
A12 of Sheet1 = 98978078

Value returned in D8 of Sheet2 = No but should be Yes.

There are no formulas in Sheet1 A:A - just numbers.
 
Upvote 0
And this is what it shows me
Book1.xlsm
A
120578950
245045645
354087780
454064135
598978078
65879517
Sheet1

Book1.xlsm
AB
1shjdshdj/ksjdksa/54064135/djashjdk/ksjljk.comYes
2jkhsakjdhslakd/kjksajdk/djksjdksa.comNo
3ioqiuieur/dskjdka/dskjdkas/98978078/dksajdksa/jdkajsdklsa.comYes
4wewjhejwhe/dskdjsak.comNo
5dsdsadsadsjrkj/45045645/popowqeqwYes
6ioqiuieur/dskjdka/dskjdkas/5879517/dksajdksa/jdkajsdklsa/Yes
7wewjhejwhe/dskdjsak.comNo
8ioqiuieur/dskjdka/dskjdkas/98978078/dksajdksa/jdkajsdklsa/Yes
Sheet2
Cell Formulas
RangeFormula
B1:B8B1=IF(COUNT(FIND(Sheet1!$A$1:$A$6,$A1))>0,"Yes","No")
 
Upvote 0
Hmm that is strange. I dragged the formula down across all data (hundreds of thousands of rows) and is says No for every single one :(

This function works ok with Office 2016, right?
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,160
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