表A 表B
范围 系数 数值 系数 第8列 第10列
0<1 5 0.5 0.3
1<2 4 1.5 0.5
2<3 3 2.5 2.5
3<4 2 3.5
4<5 1 4.5
5<∞ 0 8
请问怎样实现如下:
1.表B【数值】列=表A【范围】列时,表B【系数】列填充表A【系数】列 。
2.表B第10列直接填充表B第8列。
谢谢
[此贴子已经被作者于2009-11-19 14:02:30编辑过]
要求:1.表B【数值】列=表A【范围】列时,表B【系数】填充表A【系数】列 。
2.表B第10列直接填充表B第8列。
或者直接用公式:表B【数值】列满足什么条件时,表B【系数】填充合适的数据,公式该怎么写
[此贴子已经被作者于2009-11-19 14:01:56编辑过]
请把 "<" 改为"-"(即 0<1 改为: 0-1),
不知怎么搞的 split不认"<"符号.下面代码放在按钮中即可,
for i as integer = 0 to Tables("表A").count-1
if Tables("表A").rows(i).isnull("范围") = false then
for ii as integer = 0 to tables("表B").count-1
if tables("表B").rows(ii).isnull("数值") = false then
if Tables("表B").rows(ii)("数值") >= Tables("表A").rows(i)("范围").split("-")(0) andalso tables("表B").rows(ii)("数值") < Tables("表A").rows(i)("范围").split("-")(1)
tables("表B").rows(ii)("系数") = Tables("表A").rows(i)("系数")
end if
end if
tables("表B").rows(ii)("第八列") = Tables("表B").rows(ii)("第十列") '刚才漏了这条代码
next
end if
next
[此贴子已经被作者于2009-11-19 15:13:45编辑过]
感谢
mr725,你太有才了,基本搞定,但是5-∞ 时出错,有办法解决吗,谢谢
以下是引用wqc360在2009-11-19 16:25:00的发言:
感谢mr725,你太有才了,基本搞定,但是5-∞ 时出错,有办法解决吗,谢谢
把∞改为100000000