Hello, I'm trying to do either a sumifs or index(match() in order to sum a range of cells (multiple columns and rows) based upon a reference cell which can be modified to adjust the number of columns which are summed. For example, in the below table on the right are my results. Since A1 is 3 months, the fruit totals are summing columns B,C, & D so long as it's the appropriate type of fruit.
[TABLE="width: 500"]
<tbody>[TR]
[TD]3[/TD]
[TD]Months[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Fruit
[/TD]
[TD]1/1/2017
[/TD]
[TD]2/1/2017
[/TD]
[TD]3/1/2017
[/TD]
[TD]4/1/2017[/TD]
[TD][/TD]
[TD]Fruit
[/TD]
[TD]Total[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Apple[/TD]
[TD]10[/TD]
[TD]4[/TD]
[TD]6[/TD]
[TD]7[/TD]
[TD][/TD]
[TD]Apple[/TD]
[TD]20[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Banana[/TD]
[TD]3[/TD]
[TD]8[/TD]
[TD]1[/TD]
[TD]5[/TD]
[TD][/TD]
[TD]Banana[/TD]
[TD]12[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Orange[/TD]
[TD]2[/TD]
[TD]5[/TD]
[TD]7[/TD]
[TD]3[/TD]
[TD][/TD]
[TD]Orange[/TD]
[TD]14[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
If my variable was 4 months the results would look like:
[TABLE="width: 500"]
<tbody>[TR]
[TD]4[/TD]
[TD]Months[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Fruit
[/TD]
[TD]1/1/2017
[/TD]
[TD]2/1/2017
[/TD]
[TD]3/1/2017
[/TD]
[TD]4/1/2017[/TD]
[TD][/TD]
[TD]Fruit
[/TD]
[TD]Total[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Apple[/TD]
[TD]10[/TD]
[TD]4[/TD]
[TD]6[/TD]
[TD]7[/TD]
[TD][/TD]
[TD]Apple[/TD]
[TD]27[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Banana[/TD]
[TD]3[/TD]
[TD]8[/TD]
[TD]1[/TD]
[TD]5[/TD]
[TD][/TD]
[TD]Banana[/TD]
[TD]17[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Orange[/TD]
[TD]2[/TD]
[TD]5[/TD]
[TD]7[/TD]
[TD]3[/TD]
[TD][/TD]
[TD]Orange[/TD]
[TD]17[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Any suggestions on how to sum up the totals of ranges based upon a reference cells which makes your range dynamic? Thanks for the help!
[TABLE="width: 500"]
<tbody>[TR]
[TD]3[/TD]
[TD]Months[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Fruit
[/TD]
[TD]1/1/2017
[/TD]
[TD]2/1/2017
[/TD]
[TD]3/1/2017
[/TD]
[TD]4/1/2017[/TD]
[TD][/TD]
[TD]Fruit
[/TD]
[TD]Total[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Apple[/TD]
[TD]10[/TD]
[TD]4[/TD]
[TD]6[/TD]
[TD]7[/TD]
[TD][/TD]
[TD]Apple[/TD]
[TD]20[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Banana[/TD]
[TD]3[/TD]
[TD]8[/TD]
[TD]1[/TD]
[TD]5[/TD]
[TD][/TD]
[TD]Banana[/TD]
[TD]12[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Orange[/TD]
[TD]2[/TD]
[TD]5[/TD]
[TD]7[/TD]
[TD]3[/TD]
[TD][/TD]
[TD]Orange[/TD]
[TD]14[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
If my variable was 4 months the results would look like:
[TABLE="width: 500"]
<tbody>[TR]
[TD]4[/TD]
[TD]Months[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Fruit
[/TD]
[TD]1/1/2017
[/TD]
[TD]2/1/2017
[/TD]
[TD]3/1/2017
[/TD]
[TD]4/1/2017[/TD]
[TD][/TD]
[TD]Fruit
[/TD]
[TD]Total[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Apple[/TD]
[TD]10[/TD]
[TD]4[/TD]
[TD]6[/TD]
[TD]7[/TD]
[TD][/TD]
[TD]Apple[/TD]
[TD]27[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Banana[/TD]
[TD]3[/TD]
[TD]8[/TD]
[TD]1[/TD]
[TD]5[/TD]
[TD][/TD]
[TD]Banana[/TD]
[TD]17[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Orange[/TD]
[TD]2[/TD]
[TD]5[/TD]
[TD]7[/TD]
[TD]3[/TD]
[TD][/TD]
[TD]Orange[/TD]
[TD]17[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Any suggestions on how to sum up the totals of ranges based upon a reference cells which makes your range dynamic? Thanks for the help!