增加一个平均列,生成统计表然后遍历所有行所有列逐个计算,比如示例一:
http://www.foxtable.com/webhelp/topics/3285.htm
Dim b As New CrossTableBuilder("统计表1",DataTables("订单"))
b.HGroups.AddDef("客户") '添加客户列用于水平分组
b.VGroups.AddDef("产品") '添加产品列用于垂直分组
b.Totals.AddDef("数量") '添加数量列用于统计
b.Build '生成统计表
Maintable = Tables("统计表1") '打开生成的统计表
DataTables("统计表1").DataCols.Add("平均", GetType(Double))
for each r as row in Tables("统计表1").rows
dim n as integer = 0
dim sum as double = 0
for each c as col in Tables("统计表1").cols
if c.name <> "客户" then
if r.isnull(c.name) = false then
n += 1
sum += r(c.name)
endif
end if
next
if n>0
r("平均") = sum / n
end if
next