Rick
Sun May 11 13:45:45 CDT 2008
That returns 1 for an entry of 1a2/3 (I'm guessing it is quitting at the
first non-digit)... I would think it should return the original text if the
text doesn't meet the pattern number/slash/number. Here is my non-RegEx
attempt for a UDF...
Function GetNumberBeforeSlash(Source As Variant) As Variant
If Not Left(Source, InStr(Source & "/", "/") - 1) Like "*[!0-9]*" And _
Source Like "?*/*" And Not Source Like "*/*/*" Then
GetNumberBeforeSlash = Left(Source, InStr(Source, "/") - 1)
Else
GetNumberBeforeSlash = Source
End If
End Function
Rick
"Bernd P" <bplumhoff@gmail.com> wrote in message
news:745bcc49-2770-4a54-a308-87b69b98f163@y21g2000hsf.googlegroups.com...
> Hello,
>
> ok ok, but just for the fun of it:
> =regexpreplace(A1,"^(\d+).*$","$1")
>
> The UDF is here:
>
http://www.sulprobil.com/html/regexp.html
>
> Regards,
> Bernd