#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 70
Default formula

i want to seprate the number from the sentence.
in A1 i have a sentence . anil somchand uzenwal. vartak nagar 258932.
in a2 i have sentence . sunil 34521 vartak nagar .

i want a result in cell B1 2588932
in cell B2 34521

so pls help me . i have a lot of data . i want to seprate th all number from
th sentence. the number can be in middle or starting or the end of the
sentence.

so pls help.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default formula

Try Tom Ogilvy's code:

Public Function ReturnNumerals(rng As Range) As String
Dim sStr As String, i As Long, sStr1 As String
Dim sChar As String
sStr = rng.Value
For i = 1 To Len(sStr)
sChar = Mid(sStr, i, 1)
If sChar Like "[0-9]" Then
sStr1 = sStr1 & sChar
End If
Next
' Debug.Print sStr, sStr1
ReturnNumerals = sStr1
End Function



--
Gary's Student


"hitesh" wrote:

i want to seprate the number from the sentence.
in A1 i have a sentence . anil somchand uzenwal. vartak nagar 258932.
in a2 i have sentence . sunil 34521 vartak nagar .

i want a result in cell B1 2588932
in cell B2 34521

so pls help me . i have a lot of data . i want to seprate th all number from
th sentence. the number can be in middle or starting or the end of the
sentence.

so pls help.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default formula

Can you make VB macro, which splits up string
by Strings.split(input," ") function, array is created in result.
and then go through all elements in a loop and checks if data type is
numeric .

than you can call macro as usual excel function!

A.


"hitesh" wrote in message
...
i want to seprate the number from the sentence.
in A1 i have a sentence . anil somchand uzenwal. vartak nagar 258932.
in a2 i have sentence . sunil 34521 vartak nagar .

i want a result in cell B1 2588932
in cell B2 34521

so pls help me . i have a lot of data . i want to seprate th all number
from
th sentence. the number can be in middle or starting or the end of the
sentence.

so pls help.



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default formula

A macro to delete all but numerics.

If you wish to retain the source cells, make a copy of the data in an adjacent
column and run the macro on that column.

Sub RemoveAlphas()
' Remove alpha characters from a string.
' except for decimal points and hyphens.
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 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


Gord Dibben MS Excel MVP

On Tue, 14 Nov 2006 16:30:39 +0200, "ciruliz" wrote:

Can you make VB macro, which splits up string
by Strings.split(input," ") function, array is created in result.
and then go through all elements in a loop and checks if data type is
numeric .

than you can call macro as usual excel function!

A.


"hitesh" wrote in message
...
i want to seprate the number from the sentence.
in A1 i have a sentence . anil somchand uzenwal. vartak nagar 258932.
in a2 i have sentence . sunil 34521 vartak nagar .

i want a result in cell B1 2588932
in cell B2 34521

so pls help me . i have a lot of data . i want to seprate th all number
from
th sentence. the number can be in middle or starting or the end of the
sentence.

so pls help.



  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 70
Default formula

i dont know how to make macro as iam new. so pls explain me step by step.i
think its in visul basic. pls help

"Gord Dibben" wrote:

A macro to delete all but numerics.

If you wish to retain the source cells, make a copy of the data in an adjacent
column and run the macro on that column.

Sub RemoveAlphas()
' Remove alpha characters from a string.
' except for decimal points and hyphens.
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 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


Gord Dibben MS Excel MVP

On Tue, 14 Nov 2006 16:30:39 +0200, "ciruliz" wrote:

Can you make VB macro, which splits up string
by Strings.split(input," ") function, array is created in result.
and then go through all elements in a loop and checks if data type is
numeric .

than you can call macro as usual excel function!

A.


"hitesh" wrote in message
...
i want to seprate the number from the sentence.
in A1 i have a sentence . anil somchand uzenwal. vartak nagar 258932.
in a2 i have sentence . sunil 34521 vartak nagar .

i want a result in cell B1 2588932
in cell B2 34521

so pls help me . i have a lot of data . i want to seprate th all number
from
th sentence. the number can be in middle or starting or the end of the
sentence.

so pls help.






  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,624
Default formula

In article ,
hitesh wrote:

i dont know how to make macro as iam new. so pls explain me step by step.i
think its in visul basic. pls help


See

http://www.mvps.org/dmcritchie/excel/getstarted.htm
  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default formula

hitesh

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

On Sun, 19 Nov 2006 05:27:01 -0800, hitesh
wrote:

i dont know how to make macro as iam new. so pls explain me step by step.i
think its in visul basic. pls help

"Gord Dibben" wrote:

A macro to delete all but numerics.

If you wish to retain the source cells, make a copy of the data in an adjacent
column and run the macro on that column.

Sub RemoveAlphas()
' Remove alpha characters from a string.
' except for decimal points and hyphens.
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 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


Gord Dibben MS Excel MVP

On Tue, 14 Nov 2006 16:30:39 +0200, "ciruliz" wrote:

Can you make VB macro, which splits up string
by Strings.split(input," ") function, array is created in result.
and then go through all elements in a loop and checks if data type is
numeric .

than you can call macro as usual excel function!

A.


"hitesh" wrote in message
...
i want to seprate the number from the sentence.
in A1 i have a sentence . anil somchand uzenwal. vartak nagar 258932.
in a2 i have sentence . sunil 34521 vartak nagar .

i want a result in cell B1 2588932
in cell B2 34521

so pls help me . i have a lot of data . i want to seprate th all number
from
th sentence. the number can be in middle or starting or the end of the
sentence.

so pls help.




Gord Dibben MS Excel MVP
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
Reusing formula Tony29 Excel Discussion (Misc queries) 7 September 7th 06 03:34 AM
Dynamic Range with unused formula messing up x axis on dynamic graph [email protected] Charts and Charting in Excel 2 February 2nd 06 08:02 PM
Match then lookup Tenacity Excel Worksheet Functions 9 December 3rd 05 05:30 AM
Formula Problem - interrupted by #VALUE! in other cells!? Ted Excel Worksheet Functions 17 November 25th 05 05:18 PM
Formula checking multiple worksheets sonic-the-mouse Excel Worksheet Functions 2 June 5th 05 03:28 AM


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