和这里的用法基本差不多的http://foxtable.com/bbs/dispbbs.asp?BoardID=2&ID=147418&skin=0
Dim dtb As New DataTableBuilder("统计")
dtb.AddDef("姓名", Gettype(String), 32)
dtb.AddDef("嘉奖", Gettype(Double))
dtb.Build()
Dim lst As new List(of String)
lst.AddRange({"曹操","刘备","孙权"})
Dim dict As new Dictionary(of String,Double)
Dim lst2 As new List(of String) '记录其中是管理层的人
For Each r As Row In Tables("表A").Rows
For Each s As String In r("姓名").split(",")
If lst.Contains(s) Then lst2.Add(s)
Next
Dim fy As Double = r("嘉奖") / lst2.Count '按管理层人数平分
For Each s As String In lst2
If dict.ContainsKey(s) Then
dict(s) = dict(s) + fy
Else
dict.Add(s,fy)
End If
Next
Next
Dim dr,d2 As DataRow
For Each key As String In dict.Keys
dr = DataTables("统计").AddNew
dr("姓名") = key
dr("嘉奖") = dict(key)
Next