Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 17
Default Extracting a number in a text string

I need to extract a number from a text string. For example, Cryo Technician
$100.00. I want to extract the $100 rate and use it in another function,
i.e., Rate x hours.

I hope I made myself clear. Thanks in advance.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,047
Default Extracting a number in a text string

Hi Pogo,

try this module and use
=digitsonly(a1)

***********************************
Public Function DigitsOnly(sStr As String) As Variant
Dim oRegExp As Object

Set oRegExp = CreateObject("VBScript.RegExp")

With oRegExp
.IgnoreCase = True
.Global = True
oRegExp.Pattern = "\D"

DigitsOnly = oRegExp.Replace(sStr, vbNullString)
End With
End Function
*********************************************
hth
regards from Brazil
Marcelo



"Pogo" escreveu:

I need to extract a number from a text string. For example, Cryo Technician
$100.00. I want to extract the $100 rate and use it in another function,
i.e., Rate x hours.

I hope I made myself clear. Thanks in advance.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 17
Default Extracting a number in a text string

I am a casual user. Is this an embedded function within the Excel software. I
don't think I understand your response.


"Marcelo" wrote:

Hi Pogo,

try this module and use
=digitsonly(a1)

***********************************
Public Function DigitsOnly(sStr As String) As Variant
Dim oRegExp As Object

Set oRegExp = CreateObject("VBScript.RegExp")

With oRegExp
.IgnoreCase = True
.Global = True
oRegExp.Pattern = "\D"

DigitsOnly = oRegExp.Replace(sStr, vbNullString)
End With
End Function
*********************************************
hth
regards from Brazil
Marcelo



"Pogo" escreveu:

I need to extract a number from a text string. For example, Cryo Technician
$100.00. I want to extract the $100 rate and use it in another function,
i.e., Rate x hours.

I hope I made myself clear. Thanks in advance.

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,047
Default Extracting a number in a text string

Hi Pogo,

ok, this is not an excel function, to it run, you must copy the module above
to do it, press Alt+F11 (excel will open a VBA page) click on the INSERT
menu and chose MODULE,

COPY and PASTE the Public Function there, close the vba page and use this
User function on your spreadsheet.

hth
regards from Brazil
Marcelo

"Pogo" escreveu:

I am a casual user. Is this an embedded function within the Excel software. I
don't think I understand your response.


"Marcelo" wrote:

Hi Pogo,

try this module and use
=digitsonly(a1)

***********************************
Public Function DigitsOnly(sStr As String) As Variant
Dim oRegExp As Object

Set oRegExp = CreateObject("VBScript.RegExp")

With oRegExp
.IgnoreCase = True
.Global = True
oRegExp.Pattern = "\D"

DigitsOnly = oRegExp.Replace(sStr, vbNullString)
End With
End Function
*********************************************
hth
regards from Brazil
Marcelo



"Pogo" escreveu:

I need to extract a number from a text string. For example, Cryo Technician
$100.00. I want to extract the $100 rate and use it in another function,
i.e., Rate x hours.

I hope I made myself clear. Thanks in advance.

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,572
Default Extracting a number in a text string

If you would prefer a formula, since this *is* the 'functions' group, you
could try this:

With your string in A1, try in B1:

=--MID(A1,FIND("$",A1),25)

--

HTH,

RD
================================================== ===
Please keep all correspondence within the Group, so all may benefit!
================================================== ===


"Pogo" wrote in message
...
I am a casual user. Is this an embedded function within the Excel software.
I
don't think I understand your response.


"Marcelo" wrote:

Hi Pogo,

try this module and use
=digitsonly(a1)

***********************************
Public Function DigitsOnly(sStr As String) As Variant
Dim oRegExp As Object

Set oRegExp = CreateObject("VBScript.RegExp")

With oRegExp
.IgnoreCase = True
.Global = True
oRegExp.Pattern = "\D"

DigitsOnly = oRegExp.Replace(sStr, vbNullString)
End With
End Function
*********************************************
hth
regards from Brazil
Marcelo



"Pogo" escreveu:

I need to extract a number from a text string. For example, Cryo

Technician
$100.00. I want to extract the $100 rate and use it in another function,
i.e., Rate x hours.

I hope I made myself clear. Thanks in advance.





  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 17
Default Extracting a number in a text string

Thanks RagDyeR
This is what I wanted to do
From: Technician$125.21 To: 125.21 and I got it.

Both of these formulas worked:

=--MID(G2,FIND("$",G2),25)
=RIGHT(G4,LEN(G4)-FIND("$",G4,1))

Thanks RagDyeR

Marcelo I tried. Copied the formula into VBA Module but I couldn't noodle
it out. Thanks for trying.

"RagDyeR" wrote:

If you would prefer a formula, since this *is* the 'functions' group, you
could try this:

With your string in A1, try in B1:

=--MID(A1,FIND("$",A1),25)

--

HTH,

RD
================================================== ===
Please keep all correspondence within the Group, so all may benefit!
================================================== ===


"Pogo" wrote in message
...
I am a casual user. Is this an embedded function within the Excel software.
I
don't think I understand your response.


"Marcelo" wrote:

Hi Pogo,

try this module and use
=digitsonly(a1)

***********************************
Public Function DigitsOnly(sStr As String) As Variant
Dim oRegExp As Object

Set oRegExp = CreateObject("VBScript.RegExp")

With oRegExp
.IgnoreCase = True
.Global = True
oRegExp.Pattern = "\D"

DigitsOnly = oRegExp.Replace(sStr, vbNullString)
End With
End Function
*********************************************
hth
regards from Brazil
Marcelo



"Pogo" escreveu:

I need to extract a number from a text string. For example, Cryo

Technician
$100.00. I want to extract the $100 rate and use it in another function,
i.e., Rate x hours.

I hope I made myself clear. Thanks in advance.




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
edit text string in column B useR Excel Discussion (Misc queries) 7 April 7th 06 10:10 PM
Extracting text from text string Emile Excel Worksheet Functions 3 March 30th 06 08:44 PM
Displays the number in text. (One thousand two hundred thirty four Ashish Patel Excel Worksheet Functions 1 March 20th 06 09:27 PM
Setting the number of decimal places for a text box. Aaron1978 Excel Discussion (Misc queries) 3 March 8th 06 04:59 PM
How do I look up a number within a string of text Rich Hayes Excel Worksheet Functions 3 October 14th 05 05:49 PM


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