Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 8
Default Deleting text from number cells

Does anyone know of a quick and easy way to remove text characters from within a number? My numbers look like 186R1114F0010, 186011T3F0233 and 18H01135F0557. I have about 3,000 cells to convert to an all numeric number per day. Currently I am using the find/replace function on every letter in the alphabet. This works well but is a little tedious.

thank you for any help you can give
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,045
Default Deleting text from number cells

On Tue, 15 May 2012 22:41:13 +0000, mytyab wrote:


Does anyone know of a quick and easy way to remove text characters from
within a number? My numbers look like 186R1114F0010, 186011T3F0233 and
18H01135F0557. I have about 3,000 cells to convert to an all numeric
number per day. Currently I am using the find/replace function on every
letter in the alphabet. This works well but is a little tedious.

thank you for any help you can give


Easily done with a macro. The following assumes your data to be manipulated is in Column A, and that all the contents of column A need to have non-digits removed. If that is not the case, a different cell selection routine can be developed easily, if you like this approach. If the routine runs too slowly, it can be sped up.

To enter this Macro (Sub), <alt-F11 opens the Visual Basic Editor.
Ensure your project is highlighted in the Project Explorer window.
Then, from the top menu, select Insert/Module and
paste the code below into the window that opens.

To use this Macro (Sub), ensure the sheet with your data is active. (Work on a copy until you are happy with the results.
<alt-F8 opens the macro dialog box. Select the macro by name, and <RUN.

======================================
Option Explicit
Sub RemText()
Dim rSrc As Range, c As Range
Dim re As Object
Const sPat As String = "\D*"
Set re = CreateObject("vbscript.regexp")
re.Pattern = sPat
re.Global = True

Set rSrc = Range("A1", Cells(Rows.Count, "A").End(xlUp))

Application.ScreenUpdating = False
For Each c In rSrc
c.Value = re.Replace(c.Text, "")
Next c
Application.ScreenUpdating = True
End Sub
==============================
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 621
Default Deleting text from number cells

Add this UDF to a general module in your workbook.

Function RemAlpha(str As String) As String
'Remove Alphas from a string
Dim re As Object
Set re = CreateObject("vbscript.regexp")
re.Global = True
re.Pattern = "\D"
RemAlpha = re.Replace(str, "")
End Function

usage is =RemAlpha(cell)

Copy down as far as you need.


Gord

On Tue, 15 May 2012 22:41:13 +0000, mytyab
wrote:


Does anyone know of a quick and easy way to remove text characters from
within a number? My numbers look like 186R1114F0010, 186011T3F0233 and
18H01135F0557. I have about 3,000 cells to convert to an all numeric
number per day. Currently I am using the find/replace function on every
letter in the alphabet. This works well but is a little tedious.

thank you for any help you can give

  #4   Report Post  
Junior Member
 
Posts: 8
Thumbs up

That worked perfectly. Thank you very much!


Quote:
Originally Posted by mytyab View Post
Does anyone know of a quick and easy way to remove text characters from within a number? My numbers look like 186R1114F0010, 186011T3F0233 and 18H01135F0557. I have about 3,000 cells to convert to an all numeric number per day. Currently I am using the find/replace function on every letter in the alphabet. This works well but is a little tedious.

thank you for any help you can give
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Deleting characters in a column of cells -converting to text strin Chris Maddogz Excel Programming 2 June 15th 09 04:10 AM
Macro For Deleting Cells Containing A Number brazen234[_8_] Excel Programming 9 January 15th 06 09:32 PM
Finding & deleting cells that do not contain a certain text string clmarquez Excel Programming 2 December 6th 05 05:32 PM
Moving, deleting, and concatenating text in cells. te_butts Excel Worksheet Functions 4 September 20th 05 05:56 PM
deleting certain text from cells BLW Excel Worksheet Functions 1 May 18th 05 07:01 PM


All times are GMT +1. The time now is 11:20 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"