|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- var c = Sheets.Item("ZILIAO").Cells;
- var r = c.Item(65536,1).End(3).Row;
- var m = new Map();
- for(var i=2;i<=r;i++){
- var str = c.Item(i,2).Value2;
- var str2 = c.Item(i,5).Value2
- if(!m.has(str)){
- m.set(str,[str2]);
- }else{
- m.get(str).push(str2);
- }
- }
- var c1 = Sheets.Item("DNAPIN").Cells;
- var brr = m.get(c1.Item(2,1).Value2).reduce(function(x,y){
- if(x.indexOf(y) === -1){
- x.push(y)
- }
- return x
- },[])
- for(var i=0;i<brr.length;i++){
- c1.Item(i+2,2).Value2 = brr[i];
- }
复制代码 |
|