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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Formula
I need to extract a number from a text string, then list
the number in a diffrent cell. Please Help. pnoel |
#2
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|