SetVariable("%计数%",1) And Loop("2>1","SortCol([%计数%],""顺序号"",1) And SortCol([%计数%],""出货日期"",1) And RecalcRow([%计数%],1,Rows,1) AndSetVariable(""%计数%"",[%计数%]+1)", 10)
上面要设一数值型变量:%计数%
另,差点让你一楼公式带到阴沟里,不明白你的公式是如何执行的。