On Jun 8, 12:05 pm, Ron Rosenfeld wrote:
Ron,
Thank you. The worksheet f(x) workes perfectly. Forgive my
ignorance: With the
VB UDF (UDF?), I assume I add this as a module.
I expected to see this as a macro. Obviously, this is not the case.
Perhaps I shpould read up on
VB basics, unfortunately my work schedule
does not permit it, and the last thing I want to do aat home is learn
VB!
Are you willing to give me a quick explanation, or am I deserving of a
RTFM? :)
Thank you again. This will save me a great deal of time. With your
permission, I will share this with other co-workers.
Pete
Number formats will not work because a string with multiple "dots" is not a
number.
It's easier with a VBA UDF, but as a worksheet function, with your URL in A1 in
the form of, let us say,
12.3.45.81
Try:
=TEXT(LEFT(A1,FIND(".",A1)-1),"000") & "."
&TEXT(MID(A1,FIND(".",A1)+1,-1+FIND(
".",A1,FIND(".",A1)+1)-FIND(".",A1)),"000")&"."
&TEXT(INT(MID(A1,FIND(".",A1,FIND(".",A1)+1)
+1,255)),"000")&"."&TEXT(MID(SUBSTITUTE(
A1,".",CHAR(1),3),FIND(CHAR(1),
SUBSTITUTE(A1,".",CHAR(1),3))+1,3),"000")
This will return:
012.003.045.081
which is what I think you want.
As a VBA UDF:
==================================
Option Explicit
Function FormatURL(URL As String) As String
Dim sURL
Dim i As Long
sURL = Split(URL, ".")
'simple check only for valid URL
'could make this more comprehensive
If UBound(sURL) < 3 Then Exit Function 'not a valid URL
For i = 0 To 3
FormatURL = FormatURL & Format(sURL(i), "000\.")
Next i
'remove last "."
FormatURL = Left(FormatURL, 15)
End Function
=================================
--ron- Hide quoted text -
- Show quoted text -