Use table header in formula as reference for multiple rows calculation

Shuffler

New Member
Joined
Sep 17, 2016
Messages
2
I have 1 table named table1. It has multiple columns. I have another table named table2 where I want to fill a column with column header named ColB using a formula referencing to the cells in table1 with column header named ColA. table1 looks like this:
<code style="margin: 0px; padding: 0px; border: 0px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; white-space: inherit;"> ColA ...
---------------
1
2
3
4
5
.
.
.</code>The column ColB I want to fill has a formula, where each cell references multiple rows to table1, ColA. The formula for the 1st row of the ColB in table2 is simply a sum operation like this: (ColA row 1) + (ColA row 2) + (ColA row 3). And the formula for the 2nd row of ColB in table2 will follow as (ColA row 2) + (ColA row 3) + (ColA row 4), the rest of the column should follow this pattern.
I do not want to use cell references like for eg. A1, A2, C3... Is there a way to do this without using loop in VBA? Although I am using VBA, I want to simply apply the first formula in the first row of ColB, then autofill the formula throughout the ColB.
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
I have 1 table named table1. It has multiple columns. I have another table named table2 where I want to fill a column with column header named ColB using a formula referencing to the cells in table1 with column header named ColA. table1 looks like this:
<code style="margin: 0px; padding: 0px; border: 0px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; white-space: inherit;"> ColA ...
---------------
1
2
3
4
5
.
.
.</code>The column ColB I want to fill has a formula, where each cell references multiple rows to table1, ColA. The formula for the 1st row of the ColB in table2 is simply a sum operation like this: (ColA row 1) + (ColA row 2) + (ColA row 3). And the formula for the 2nd row of ColB in table2 will follow as (ColA row 2) + (ColA row 3) + (ColA row 4), the rest of the column should follow this pattern.
I do not want to use cell references like for eg. A1, A2, C3... Is there a way to do this without using loop in VBA? Although I am using VBA, I want to simply apply the first formula in the first row of ColB, then autofill the formula throughout the ColB.


Let me simplify the problem. I need help creating a function that returns a cell address, of a cell, with inputs as (table as listobject, headername as string, row as integer), where row would mean which row of the table within the data body range that the cell is located, under the column header name passed as headername.
 
Upvote 0

Forum statistics

Threads
1,215,368
Messages
6,124,523
Members
449,169
Latest member
mm424

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top