Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
jtoy
 
Posts: n/a
Default Extracting Text only

I'm trying to extract text only from a column of cells with varying text and
number strings. Sometimes the cell starts with numbers, other times text.
There is no constant for the number at the beginning of the cells.

Assuming all data in column C.

Went through all the functions and couldn't find anything this simple. Or
maybe it's not that simple?

thanks!
  #2   Report Post  
Gord Dibben
 
Posts: n/a
Default

Not so simple if data is mixed up as you state.

I would use this macro to strip out all the numbers.

Select the range in column C then run the macro.

Sub RemoveNums()
'' Remove numeric characters from a string.
Dim intI As Integer
Dim rngR As Range, rngRR As Range
Dim strNotNum As String, strTemp As String
Set rngRR = Selection.SpecialCells(xlCellTypeConstants, _
xlTextValues)
For Each rngR In rngRR
strTemp = ""
For intI = 1 To Len(rngR.Value)
If Not (Mid(rngR.Value, intI, 1)) Like "[0-9]" Then
strNotNum = Mid(rngR.Value, intI, 1)
Else: strNotNum = ""
End If
strTemp = strTemp & strNotNum
Next intI
rngR.Value = strTemp
Next rngR
End Sub

If not familiar with VBA and macros, see David McRitchie's site for more on
"getting started".

http://www.mvps.org/dmcritchie/excel/getstarted.htm

In the meantime..........

First...create a backup copy of your original workbook.

To create a General Module, hit ALT + F11 to open the Visual Basic Editor.

Hit CRTL + R to open Project Explorer.

Find your workbook/project and select it.

Right-click and InsertModule. Paste the code in there. Save the
workbook and hit ALT + Q to return to your workbook.

Run the macro by going to ToolMacroMacros.

You can also assign this macro to a button or a shortcut key combo.


Gord Dibben Excel MVP

On Sat, 30 Jul 2005 08:54:02 -0700, "jtoy"
wrote:

I'm trying to extract text only from a column of cells with varying text and
number strings. Sometimes the cell starts with numbers, other times text.
There is no constant for the number at the beginning of the cells.

Assuming all data in column C.

Went through all the functions and couldn't find anything this simple. Or
maybe it's not that simple?

thanks!


  #3   Report Post  
CLR
 
Posts: n/a
Default

ASAP Utilities, a free add-in available at www.asap-utilities.com includes
this capabaility among it's many nifty features.

Vaya con Dios,
Chuck, CABGx3



"jtoy" wrote in message
...
I'm trying to extract text only from a column of cells with varying text

and
number strings. Sometimes the cell starts with numbers, other times text.
There is no constant for the number at the beginning of the cells.

Assuming all data in column C.

Went through all the functions and couldn't find anything this simple. Or
maybe it's not that simple?

thanks!



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
Extracting text from a cell entry morchard Excel Discussion (Misc queries) 2 July 6th 05 03:53 PM
Extracting a 'number' from text Anthony Slater Excel Discussion (Misc queries) 4 April 5th 05 01:47 PM
extracting data from a text string of varying length andy from maine Excel Discussion (Misc queries) 4 March 28th 05 07:11 PM
Extracting and using Text from external sources Palmley Excel Worksheet Functions 6 January 14th 05 12:22 AM
EXTRACTING TEXT EstherJ Excel Discussion (Misc queries) 3 December 16th 04 05:27 PM


All times are GMT +1. The time now is 06:58 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"