Sorting IP addresses in MS Excel

Yess – I finally got my Microsoft Excel 2010 formula working.  My local settings use semicolon (“;”) instead of comma (“,”) that was used on this source at Microsoft forum (short link: http://littleurl.info/j1p).  Thanks to Zorvek.

  1. Place the IP addresses You want to sort in colum A
  2. Place the formula below in column B
  3. Sort Your columns with B as the sorting key.
  4. Voilà – You manage hopefully to sort IP addresses correctly!

Norwegian regional settings (semicolon “;”)

<br>=MID("00"&amp;+A1;LEFT(FIND(".";A1)-1);3) &amp;"."&amp; RIGHT("00"&amp;MID(A1;FIND(".";A1)+1;FIND("|";SUBSTITUTE(A1;".";"|";2))-FIND(".";A1)-1);3) &amp;"."&amp; RIGHT("00"&amp;MID(A1;FIND("|";SUBSTITUTE(A1;".";"|";2))+1;FIND("|";SUBSTITUTE(A1&amp;".";".";"|";3))-FIND("|";SUBSTITUTE(A1;".";"|";2))-1);3) &amp;"."&amp; RIGHT("00"&amp;RIGHT(A1;LEN(A1)-FIND("|";SUBSTITUTE(A1;".";"|";LEN(A1)-LEN(SUBSTITUTE(A1;".";"")))));3)<br>

England / U.S.A. regional settings (comma “.”)

<br>=MID("00"&amp;+A1,LEFT(FIND(".",A1)-1),3) &amp;"."&amp; RIGHT("00"&amp;MID(A1,FIND(".",A1)+1,FIND("|",SUBSTITUTE(A1,".","|",2))-FIND(".",A1)-1),3) &amp;"."&amp; RIGHT("00"&amp;MID(A1,FIND("|",SUBSTITUTE(A1,".","|",2))+1,FIND("|",SUBSTITUTE(A1&amp;".",".","|",3))-FIND("|",SUBSTITUTE(A1,".","|",2))-1),3) &amp;"."&amp; RIGHT("00"&amp;RIGHT(A1,LEN(A1)-FIND("|",SUBSTITUTE(A1,".","|",LEN(A1)-LEN(SUBSTITUTE(A1,".",""))))),3)<br>