Find 10+ number strings within text

joshbjames

New Member
Joined
Jul 25, 2017
Messages
33
I have a column of data with no particular structure to the characters. They are notes containing combinations of dates, model numbers ect... I'd like to find just the strings of 10+ numbers. Sometimes the numbers are consecutive, sometimes separated by a "-", "/" or " ". Below is an example of the results Id like. I will bold the text that triggers the flag.

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Note[/TD]
[TD]Result[/TD]
[/TR]
[TR]
[TD]James 11/12 123-456 7 890 Truck[/TD]
[TD]TRUE[/TD]
[/TR]
[TR]
[TD]1234567890 11/12 James Truck[/TD]
[TD]TRUE[/TD]
[/TR]
[TR]
[TD]11/12 James 123-45678-90 Truck[/TD]
[TD]TRUE[/TD]
[/TR]
[TR]
[TD]11/12 James Truck 123 45 678 90[/TD]
[TD]TRUE[/TD]
[/TR]
[TR]
[TD]11/12 James Truck[/TD]
[TD]FALSE[/TD]
[/TR]
[TR]
[TD]1 2-3-4 5 6 7-8 9-0[/TD]
[TD]TRUE[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
I have a column of data with no particular structure to the characters. They are notes containing combinations of dates, model numbers ect... I'd like to find just the strings of 10+ numbers. Sometimes the numbers are consecutive, sometimes separated by a "-", "/" or " ".
Give this UDF a try...
Code:
[table="width: 500"]
[tr]
	[td]Function TenOrMoreDigits(S As String)
  TenOrMoreDigits = Replace(Replace(Replace(S, " ", ""), "/", ""), "-", "") Like "*##########*"
End Function[/td]
[/tr]
[/table]

HOW TO INSTALL UDFs
------------------------------------
If you are new to UDFs, they are easy to install and use. To install it, simply press ALT+F11 to go into the VB editor and, once there, click Insert/Module on its menu bar, then copy/paste the above code into the code window that just opened up. That's it.... you are done. You can now use TenOrMoreDigits just like it was a built-in Excel function. For example,

=TenOrMoreDigits(A1)

If you are using XL2007 or above, make sure you save your file as an "Excel Macro-Enabled Workbook (*.xlsm) and answer the "do you want to enable macros" question as "yes" or "OK" (depending on the button label for your version of Excel) the next time you open your workbook.
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,305
Members
452,633
Latest member
DougMo

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