0
$\begingroup$

I'm attempting to build a 33 X 954 array filled with the following Excel formulas:

firstcolumn = Table[StringJoin["=Knowledge!F", ToString[i]], {i, 2, 34}];

secondcolumn = Table[StringJoin["=Knowledge!F", ToString[i]], {i, 35, 67}];

thirdcolumn = Table[StringJoin["=Knowledge!F", ToString[i]], {i, 68, 100}];

i.e.; where r=33 and the indexes increase as follows: {i,(i1 + r),(i2 + r)}

until we get:

lastcolumn = Table[StringJoin["=Knowledge!F", ToString[i]], {i, 31451, 31483}];

Thank you!

$\endgroup$
2
  • 1
    $\begingroup$ Like this? Transpose@Partition[ StringJoin["=Knowlege!F", ToString@#] & /@ Range[2, 31483] , 33] $\endgroup$
    – N.J.Evans
    Commented Sep 26, 2016 at 16:32
  • 1
    $\begingroup$ Jesus that was fast! Thank you for your help N.J. Evans! $\endgroup$ Commented Sep 26, 2016 at 16:37

1 Answer 1

1
$\begingroup$

Since you're wanting all number from 2-31483 and the operation is the same for each number, it's probably best just to map a function over the range, then split it into sub-lists using Partition. If you want the result to run down the columns, you should apply Transpose at the end.

columns=StringJoin["=Knowlege!F", ToString@#] & /@ Range[2, 31483];
columns=Partition[columns,33];
columns=Transpose@columns

For illustration: Partition[Range[9],3] gives:{{1,2,3},{4,5,6},{7,8,9}} and Transpose@Partition[Range[9],3] gives:{{1,4,7},{2,5,8},{3,6,9}}

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.