* 拆分 IP 地址后再分类

Excel里有一列标准的IP v4地址:


A
1 10.12.20.30
2 10.205.20.30
3 10.178.20.30
4 10.23.20.30
5 10.167.20.30
6 10.90.20.30
7 10.134.20.30
8 10.177.20.30
9 10.200.20.30
10 10.115.20.30
11 10.48.20.30
12 10.181.20.30
13 10.224.20.30
14 10.57.20.30
15 10.180.20.30
16 10.113.20.30
17 10.246.20.30
18 10.179.20.30

请将IP的第2节均分为四份,即0-6364-127128-191192-256,分别写入四列。


C D E F
1 10.12.20.30 10.90.20.30 10.178.20.30 10.205.20.30
2 10.23.20.30 10.115.20.30 10.167.20.30 10.200.20.30
3 10.48.20.30 10.113.20.30 10.134.20.30 10.224.20.30
4 10.57.20.30
10.177.20.30 10.246.20.30
5

10.181.20.30
6

10.180.20.30
7

10.179.20.30

使用 SPL XLL,输入公式:

=spl("=E@p(E@1(?).group(int(~.split($[.])(2))\64))",A1:A18)

Picture1png

函数 E@p 对表格进行横纵转置,E@1 将表格转为一维,group 分组,~ 表示当前成员,\表示除法取整数部分。

来源:https://www.reddit.com/r/excel/comments/1cdidn1/sort_list_of_ip_addresses_into_one_of_4_columns/