Filter column if it contains number in text string with leading "4"

programsam

Board Regular
Joined
Feb 10, 2016
Messages
123
Attempting to filter a column out if it contains a 10 digit number in a TEXT string with a leading "4" such as 4********.

Sample Number: 4200114091
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
If that column is actually text, then using Does not begin with 4 should work.
 
Upvote 0
is it a number or is it text

sumproduct() maybe what you need

filter(the array of cells you want to show, left(cell with the numbers in , 1)="4")

=FILTER(A2:B6,LEFT(A2:A6,1)="4")

Book2
ABCDEF
1
24200114091a4200114091a
34200114091b4200114091b
41c4e
53d
64e
Sheet1
Cell Formulas
RangeFormula
E2:F4E2=FILTER(A2:B6,LEFT(A2:A6,1)="4")
Dynamic array formulas.


to only filter 10 digit numbers
=FILTER(A2:B6,(LEFT(A2:A6,1)="4")*(LEN(A2:A6)=10))

Book2
ABCDEFG
1
24200114091a4200114091a
34200114091b4200114091b
41c
53d
64e
Sheet1
Cell Formulas
RangeFormula
E2:F3E2=FILTER(A2:B6,(LEFT(A2:A6,1)="4")*(LEN(A2:A6)=10))
Dynamic array formulas.
 
Upvote 0
Should have been more specific, needed it done in Power Query... this worked.

Excel Formula:
= Table.AddColumn(#"Filtered Rows", "Custom", each List.Select(Text.SplitAny([Text],Text.Remove([Text],{"0".."9"})),each Text.StartsWith(_,"4") and Text.Length(_)=10){0}?)
 
Upvote 0

Forum statistics

Threads
1,223,317
Messages
6,171,419
Members
452,402
Latest member
siduslevis

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