Something like this? You'll need to hit CONTROL+SHIFT+ENTER as the formula uses arrays.
[TABLE="class: grid, width: 414"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]...[/TD]
[TD]AB[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]n=[/TD]
[TD]4[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Sum columns:[/TD]
[TD="align: right"]=SUM(IF(MOD(COLUMN(A$5:AB$104),B1)=0,A$5:AB$104))[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]5[/TD]
[TD="align: right"]0.371155968[/TD]
[TD="align: right"]0.702672[/TD]
[TD="align: right"]0.468813[/TD]
[TD="align: right"]0.410523[/TD]
[TD="align: right"]...[/TD]
[TD="align: right"]0.396036[/TD]
[/TR]
[TR]
[TD="align: right"]6[/TD]
[TD="align: right"]0.426536578[/TD]
[TD="align: right"]0.464798[/TD]
[TD="align: right"]0.02317[/TD]
[TD="align: right"]0.242622[/TD]
[TD="align: right"]...[/TD]
[TD="align: right"]0.174385[/TD]
[/TR]
[TR]
[TD="align: right"]7[/TD]
[TD="align: right"]0.424560384[/TD]
[TD="align: right"]0.243813[/TD]
[TD="align: right"]0.21639[/TD]
[TD="align: right"]0.327721[/TD]
[TD="align: right"]...[/TD]
[TD="align: right"]0.001815[/TD]
[/TR]
[TR]
[TD="align: right"]8[/TD]
[TD="align: right"]0.043125384[/TD]
[TD="align: right"]0.579772[/TD]
[TD="align: right"]0.04318[/TD]
[TD="align: right"]0.087144[/TD]
[TD="align: right"]...[/TD]
[TD="align: right"]0.319651[/TD]
[/TR]
[TR]
[TD="align: right"]9[/TD]
[TD="align: right"]0.711210033[/TD]
[TD="align: right"]0.584506[/TD]
[TD="align: right"]0.583156[/TD]
[TD="align: right"]0.307808[/TD]
[TD="align: right"]...[/TD]
[TD="align: right"]0.160351[/TD]
[/TR]
[TR]
[TD="align: right"]...[/TD]
[TD="align: right"]...[/TD]
[TD="align: right"]...[/TD]
[TD="align: right"]...[/TD]
[TD="align: right"]...[/TD]
[TD="align: right"]...[/TD]
[TD="align: right"]...[/TD]
[/TR]
[TR]
[TD="align: right"]102[/TD]
[TD="align: right"]0.217490312[/TD]
[TD="align: right"]0.205901[/TD]
[TD="align: right"]0.017295[/TD]
[TD="align: right"]0.554897[/TD]
[TD="align: right"]...[/TD]
[TD="align: right"]0.310382[/TD]
[/TR]
[TR]
[TD="align: right"]103[/TD]
[TD="align: right"]0.34791251[/TD]
[TD="align: right"]0.840192[/TD]
[TD="align: right"]0.504437[/TD]
[TD="align: right"]0.080458[/TD]
[TD="align: right"]...[/TD]
[TD="align: right"]0.917384[/TD]
[/TR]
[TR]
[TD="align: right"]104[/TD]
[TD="align: right"]0.122595243[/TD]
[TD="align: right"]0.650957[/TD]
[TD="align: right"]0.587608[/TD]
[TD="align: right"]0.886758[/TD]
[TD="align: right"]...[/TD]
[TD="align: right"]0.405192[/TD]
[/TR]
</tbody>[/TABLE]