A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Formula



 
 
Thread Tools Display Modes
  #1  
Old September 15th, 2003, 02:16 PM
pnoel
external usenet poster
 
Posts: n/a
Default Formula

I need to extract a number from a text string, then list
the number in a diffrent cell.

Please Help.

pnoel
  #2  
Old September 15th, 2003, 02:44 PM
Mike
external usenet poster
 
Posts: n/a
Default Formula

Show a couple of the text string examples from which you want to extract the numbers.

--
Mike

Ref to "pnoel" wrote in message ...
  #3  
Old September 15th, 2003, 04:10 PM
Ron Rosenfeld
external usenet poster
 
Posts: n/a
Default Formula

On Mon, 15 Sep 2003 06:16:29 -0700, "pnoel"
wrote:

I need to extract a number from a text string, then list
the number in a diffrent cell.

Please Help.

pnoel


This VBA routine might work for you. It will extract all of the numeric
characters from a string:

====================
Function GetValue(str)
Dim N As Integer, i As String
i = ""
For N = 1 To Len(str)
If IsNumeric(Mid(str, N, 1)) Then
i = i & Mid(str, N, 1)
If Mid(str, N + 1, 1) = "." Then i = i & "."
End If
Next
If i = "" Then
GetValue = i
Exit Function
End If
GetValue = CDbl(i)
End Function
================

To enter it, altF11 opens the VB Editor.

With your current project highlighted in the Project Explorer window,
Insert/Module and paste the above into the window that opens.

To use the routine, enter a formula of the type:

=GetValue(A1)

where your mixed string is stored in A1.


--ron
  #4  
Old September 15th, 2003, 07:04 PM
Harlan Grove
external usenet poster
 
Posts: n/a
Default Formula

"pnoel" wrote...
I need to extract a number from a text string, then list
the number in a diffrent cell.


For a non-VBA alternative, see

http://www.google.com/groups?selm=uB...wsrange r.com

--
Never attach files.
Snip unnecessary quoted text.
Never multipost (though crossposting is usually OK).
Don't change subject lines because it corrupts Google newsgroup archives.
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:21 PM.


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