LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #10   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,071
Default FORMULA TO REMOVE TEXT FROM A CELL

This macro, a slight modification of Per Jessen's macro to preserve the
period, will do that. HTH Otto
Sub ExtractNumber()
Dim MyVal As String
Dim n As Long
Dim cell As Range
For Each cell In Selection.Cells
MyVal = ""
For n = 1 To Len(cell)
If IsNumeric(Mid(cell, n, 1)) Or _
Mid(cell, n, 1) = "." Then
MyVal = MyVal & Mid(cell, n, 1)
End If
Next
cell.Value = MyVal
MyVal = 0
Next
End Sub
"Per Jessen" wrote in message
...
Then, select the cells to be converted and run this macro:

Sub ExtractNumber()
Dim MyVal As Long
Dim n As Long

For Each cell In Selection.Cells
For n = 1 To Len(cell)
If IsNumeric(Mid(cell, n, 1)) Then
MyVal = MyVal & Mid(cell, n, 1)
End If
Next
cell.Value = MyVal
MyVal = 0
Next
End Sub

Regards,
Per

"Faraz A. Qureshi" skrev i
meddelelsen ...
I am sorry what I sought was to have all the text be removed. Like:

1234Text
12Text34
Text1234

be converted to:

1234
1234
1234

--
Best Regards,

Faraz



"Per Jessen" wrote:

Hi

Use this formula in a helper column, assuming 12 is a true value:

=IF(ISERROR(VALUE(A1)),VALUE(LEFT(A1,FIND("K"A1)-2))A1)

Regards,
Per

"Faraz A. Qureshi" skrev i
meddelelsen ...
I have some entries like:

10 Kg
15 Kilo
12
13.5 Kilogram

How, to have all the text be removed from the same having the
numericals
remained presented as:

10
15
12
13.5

--
Best Regards,

Faraz







 
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
Remove text from cell ThomasVike Excel Worksheet Functions 10 December 15th 09 02:46 PM
Formula to remove certain text Angela1979 Excel Worksheet Functions 4 February 12th 07 03:23 PM
Easiest way to remove text from a cell that has text and numbers? [email protected] Excel Discussion (Misc queries) 2 August 17th 06 06:07 PM
Remove some text from a cell JW Excel Worksheet Functions 2 August 16th 06 11:12 PM
remove text from cell Sam Excel Discussion (Misc queries) 2 July 25th 06 04:06 PM


All times are GMT +1. The time now is 03:12 AM.

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

About Us

"It's about Microsoft Excel"