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.

NoteResult
James 11/12 123-456 7 890 TruckTRUE
1234567890 11/12 James TruckTRUE
11/12 James 123-45678-90 TruckTRUE
11/12 James Truck 123 45 678 90TRUE
11/12 James TruckFALSE
1 2-3-4 5 6 7-8 9-0TRUE

<tbody>
</tbody>
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
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,214,911
Messages
6,122,198
Members
449,072
Latest member
DW Draft

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