Hi,
Please try the following script:
ncols = wks.nCols;
nsub = 16;
for (int i=1; i <= ncols; i++)
{
n = count(wcol(i));
avgi = (total(wcol(i)[1:nsub])+total(wcol(i)[n-nsub+1:n]))/(2*nsub);
wks.AddCol();
wcol(ncols+i) = wcol(i)/avgi;
wcol(ncols+i)[L]$ = "NewCol$(i)";
}
Thanks,
James