Reference Cells in Formula move as a new column is added

GrilledCheese

Board Regular
Joined
Apr 23, 2014
Messages
75
Okay, the formula is located in cell DJ12. The formula reads =SUM(DF13:DH13)/SUM(DF12:DH12). I will be adding a new column to the left of the cell DJ12. Okay. So the formula is now located in cell DK12. Now, I want the formula to read =SUM(DG13:DI13)/SUM(DG12:DI12). Any help to automate this formula? I'm stuck.
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
I think the easiest suggestion is to insert a blank column, DJ. Your new column DJ12 will become DK12, and the formula will be =SUM(DF13:DJ13)/SUM(DF12:DJ12). From now on, insert any new column in front of the blank column DJ.

Another option is to define a named range. In your original setup, go to cell DJ12, Define, Name:=cellToLeft, RefersTo:=DI13 (all relative references, no $ signs). So now, you use this formula:

=SUM(DF13:cellToLeft)/SUM(DF12:OFFSET(cellToLeft, -1, 0))
 
Upvote 0
The first suggestion doesn't work. I tried that. In regards to the 2nd suggestion, how do I define a named range?
I think the easiest suggestion is to insert a blank column, DJ. Your new column DJ12 will become DK12, and the formula will be =SUM(DF13:DJ13)/SUM(DF12:DJ12). From now on, insert any new column in front of the blank column DJ.

Another option is to define a named range. In your original setup, go to cell DJ12, Define, Name:=cellToLeft, RefersTo:=DI13 (all relative references, no $ signs). So now, you use this formula:

=SUM(DF13:cellToLeft)/SUM(DF12:OFFSET(cellToLeft, -1, 0))
 
Upvote 0
It's relative to the cell you're currently on.


For example, activate cell B1. Go to Define Name. Make the Refers To A1, and make sure it's fully relative (no $ symbols).

Now, in any other cell, your name cellToLeft will always refer to the cell immediately to the left, regardless of insertion, cut/paste, etc.
 
Upvote 0
Use a named range that extends dynamically based on a specific row:

Named Range = TestRange

=OFFSET(FormulaSheet!9:9, 0, 0, 1,COUNTA(FormulaSheet!9:9)) This formula goes in the Name Manager Range Box. Change 9 to whatever row you are on....

For Example:

Excel 2012
ABCD
91234
1010
FormulaSheet
Cell Formulas
RangeFormula
A10=SUM(TestRange)
Named Ranges
NameRefers ToCells
TestRange=OFFSET(FormulaSheet!9:9, 0, 0, 1,COUNTA(FormulaSheet!9:9))


If you add extra values to the range like this:

Excel 2012
ABCDEF
9123456
1021
FormulaSheet
Cell Formulas
RangeFormula
A10=SUM(TestRange)
Named Ranges
NameRefers ToCells
TestRange=OFFSET(FormulaSheet!9:9, 0, 0, 1,COUNTA(FormulaSheet!9:9))



The sum will update accordingly. Note: The cells to the right of the range(row) must be blank ("")
 
Last edited:
Upvote 0
I think this option would work great for summing one row but in my case, I want the formula to take the sum of one row and divide it by the sum of the row above it. Also, there are values to the right of the formula.
Use a named range that extends dynamically based on a specific row:

Named Range = TestRange

=OFFSET(FormulaSheet!9:9, 0, 0, 1,COUNTA(FormulaSheet!9:9)) This formula goes in the Name Manager Range Box. Change 9 to whatever row you are on....

For Example:
Excel 2012
ABCD
91234
1010

<colgroup><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
FormulaSheet

Worksheet Formulas
CellFormula
A10=SUM(TestRange)

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>

Workbook Defined Names
NameRefers To
TestRange=OFFSET(FormulaSheet!9:9, 0, 0, 1,COUNTA(FormulaSheet!9:9))

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>



If you add extra values to the range like this:
Excel 2012
ABCDEF
9123456
1021

<colgroup><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
FormulaSheet

Worksheet Formulas
CellFormula
A10=SUM(TestRange)

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>

Workbook Defined Names
NameRefers To
TestRange=OFFSET(FormulaSheet!9:9, 0, 0, 1,COUNTA(FormulaSheet!9:9))

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>




The sum will update accordingly. Note: The cells to the right of the range(row) must be blank ("")
 
Upvote 0
This is what I'm trying to accomplish. The 3 month formula is showing the % of what was sold to what was purchased. Formula is located in L2 for the 3 month (January, February, and March) and is =sum(H3:J3)/sum(H2:J2). So, next month, I want the 3 month formula to be (February, March, and April).
JanuaryFebruaryMarchApril3month
Purchased152025 70.00%
Sold91815

<tbody>
</tbody><colgroup><col><col span="3"><col><col></colgroup>
 
Upvote 0
Use this formula in L2:

Code:
=SUM(OFFSET(L2,1,-4),OFFSET(L2,1,-3), OFFSET(L2,1,-2))/SUM((OFFSET(L2,0,-4),OFFSET(L2,0,-3),OFFSET(L2,0,-2) ))

There is probably a simpler way but it gets the job done....
 
Upvote 0

Forum statistics

Threads
1,214,872
Messages
6,122,026
Members
449,061
Latest member
TheRealJoaquin

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