LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Find the first numeric substring

Ooops, my mistake about that. Um, all my data
samples ONLY contain whole numbers or integer
substrings, so there will never be any floating
point numbers.

To be even more precise, I am only looking for
an ALL numeric substring that has at least one
whitespace character on the left and at least
one whitespace character on the right.


Hmm! That changes everything. Okay, here is a function that will do this (it
can be used as a UDF, user defined function, if needed)...

Function GetNumber(ByVal Text As String) As Double
Dim X As Long, Temp As String
Text = Replace(Text, Chr(160), " ")
For X = 1 To Len(Text)
Temp = Mid(Text, X)
If Temp Like " #*" Then
Temp = Left(LTrim(Temp), InStr(LTrim(Temp), " ") - 1)
If Not Temp Like "*[!0-9]*" Then Exit For
End If
Next
GetNumber = Temp
End Function

Rick Rothstein (MVP - Excel)



 
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
Find Numeric data RobWN Excel Worksheet Functions 16 August 27th 07 12:09 AM
Find and Return Numeric Label based on (Numeric Value) Criterion Sam via OfficeKB.com Excel Worksheet Functions 2 September 18th 06 11:20 PM
Find Numeric Criterion in Column & Return the Numeric Value from Row above Sam via OfficeKB.com Excel Worksheet Functions 6 April 27th 06 02:50 PM
Find numeric value at end of string Barb Reinhardt Excel Worksheet Functions 13 February 4th 06 11:31 PM
MACRO TO FIND SUBSTRING OR SUBTEXT ! jay dean Excel Programming 3 November 20th 04 07:33 PM


All times are GMT +1. The time now is 06:40 PM.

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"