Excel表格中实现IP地址排序

需要插入辅助列,用辅助列来进行排序,公式如下:

=TRIM(TEXT(LEFT(SUBSTITUTE(A1,".",REPT(" ",99)),100),"000")&TEXT(MID(SUBSTITUTE(A1,".",REPT(" ",99)),100,100),"000")&TEXT(MID(SUBSTITUTE(A1,".",REPT(" ",99)),200,100),"000")&TEXT(MID(SUBSTITUTE(A1,".",REPT(" ",99)),300,100),"000"))

原理就是把IP中的0给填充上,再把小数点去掉,实现字符串的对比排序。

你可能感兴趣的:(其他)