4.15 行式数据排名 - 按表达式
将成绩表按数学、英语、体育三科总分计算排名:
Class | Name | Maths | English | PE |
---|---|---|---|---|
1 | Tom | 85 | 97 | 74 |
2 | John | 92 | 80 | 95 |
2 | Joan | 86 | 67 | 85 |
1 | Rocky | 95 | 95 | 75 |
2 | Ham | 92 | 75 | 53 |
1 | Kate | 83 | 99 | 50 |
1 | Rose | 95 | 62 | 81 |
2 | Nomy | 78 | 91 | 70 |
1 | Neil | 91 | 83 | 97 |
2 | Jack | 84 | 75 | 73 |
1 | Joe | 98 | 71 | 60 |
脚本:
A | |
---|---|
1 | =T(“score.xlsx”) |
2 | =A1.(Maths+English+PE) |
3 | =A1.derive(A2.rank@z(Maths+English+PE):Rank) |
A2 获得数学、英语、体育三科总分的序列
A3 向 A1 中添加排名字段,用 A2 计算当前行的数学、英语、体育总分排名
运行结果:
Class | Name | Maths | English | PE | Rank |
---|---|---|---|---|---|
1 | Tom | 85 | 97 | 74 | 4 |
2 | John | 92 | 80 | 95 | 2 |
2 | Joan | 86 | 67 | 85 | 6 |
1 | Rocky | 95 | 95 | 75 | 3 |
2 | Ham | 92 | 75 | 53 | 11 |
1 | Kate | 83 | 99 | 50 | 8 |
1 | Rose | 95 | 62 | 81 | 6 |
2 | Nomy | 78 | 91 | 70 | 5 |
1 | Neil | 91 | 83 | 97 | 1 |
2 | Jack | 84 | 75 | 73 | 8 |
1 | Joe | 98 | 71 | 60 | 10 |