Eg.
1.1.1.1
1.1.1.251
1.1.1.3
1.1.1.5
1.1.1.61
The result that I am hoping for is;
1.1.1.1
1.1.1.3
1.1.1.5
1.1.1.61
1.1.1.251
Any help would be appreciated
Thanks and regards
Rob
I guess you have to create a formula in a parallel column that gives a result
that will sort correctly,
e.g. giving (((1*1000)+1)*1000)+1)*1000+251 = 1001001251
Now for the tricky bit - making the formula.
Whilst it would be possible to do it using what John Walkenbach calls a
megaformula, I think it would be easier to use a VBA function.
Function SortIPCode(IPCode As String) As Double
Dim iDot As Integer
Dim stLeft As String
Dim dResult As Double
stLeft = IPCode
iDot = InStr(stLeft, ".")
Do Until iDot = 0
dResult = dResult * 1000 + Int(Left(stLeft, iDot - 1))
stLeft = Mid(stLeft, iDot + 1)
iDot = InStr(stLeft, ".")
Loop
SortIPCode = dResult * 1000 + Int(stLeft)
End Function
Put this in a standard module.
In your worksheet, if your IP addresses are in A2:A100, and column B is not
used, put this formula in B2
=SortIPCode(A2)
and fill it down to B100
Then sort on column B.
Bill Manville
MVP - Microsoft Excel, Oxford, England
No email replies please - reply in newsgroup
--
HTH
Dana DeLouis Windows Me & Office XP
"Rob Covey" <rober...@hotmail.com> wrote in message
news:2d2d01c1050c$e3849d30$9ae62ecf@tkmsftngxa02...
HTH,
David McRitchie, Microsoft MVP - Excel
My Excel Macros: http://www.geocities.com/davemcritchie/excel/excel.htm
Search Page: http://www.geocities.com/davemcritchie/excel/search.htm
"Dana DeLouis" <ng_...@hotmail.com> wrote in message news:e$K5fBfBBHA.1188@tkmsftngp05...