Sum cells to left of current cell

RockandGrohl

Well-known Member
Joined
Aug 1, 2018
Messages
790
Office Version
  1. 365
Platform
  1. Windows
For some reason I can't articulate this into google.

I'm using
Excel Formula:
=SUM($A6:INDEX(6:6,COLUMN()-1))
to sum all cells to the left of the cell where the formula is written.

I need something with a similar function, where I have a column at the end of a set of data which is subtracting one value from another.

Trouble is, whenever I insert a new column the existing formula doesn't keep up and I have to change it, a small irritation.
Excel Formula:
=BC5-BB5

So is there a way to say "Take the value immediately left of the current cell and subtract for the value two cells left of the current cell"?

I'm sure there's a better way to word that, I think I need to use cell references?

The end goal of this is to be able to insert as many columns in as I want to add data to a table, with the "Variance" column at the end cleanly updating to reference the new cells without me sorting it out over so many pages. Thanks!
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Hi

Not getting the query, can you please manually type what error you are currently getting and what is your expected result.
 
Upvote 0
Hi

Not getting the query, can you please manually type what error you are currently getting and what is your expected result.
Hi, I need a formula that considers cell position rather than cell reference.

So if my formula is in cell T6, "=S6-R6", it would be fine up until I insert a column in Column S, which then means my formula is in cell U6, but it's still referencing =S6-R6 - meaning there's a gap.


If my formula instead said "Value to left of current cell subtract value two cells left of current cell" this would work, because no matter how many columns I insert, it doesn't change.

Does that make sense or are you even more confused lol.
 
Upvote 0
Try

Book3
PQRSTU
1
2
3
4
5
6
7110
8
9
10
11
Sheet1
Cell Formulas
RangeFormula
T7T7=INDEX($R7:S7,,COUNT($R7:S7))-INDEX($R7:S7,,COUNT($R7:S7)-1)
 
Upvote 0
Try

Book3
PQRSTU
1
2
3
4
5
6
7110
8
9
10
11
Sheet1
Cell Formulas
RangeFormula
T7T7=INDEX($R7:S7,,COUNT($R7:S7))-INDEX($R7:S7,,COUNT($R7:S7)-1)
Hi, unfortunately not because as soon as you insert a new column in between, the formula is still referencing the old cells.

new cell.png


Here, -4171 is the variance cell. 34,993 going to 30,822 is a variance of -4171

When April's data is available, I insert a new column, and this means I have to move the formula references over.

If instead the formula only considered the two cells immediately left, then it wouldn't matter if I added or removed columns, it would always give me the variance for the last 2 dates.
 
Upvote 0
Found it.

This is what I want.

Excel Formula:
=OFFSET(INDIRECT(ADDRESS(ROW(), COLUMN())),0,-1)-OFFSET(INDIRECT(ADDRESS(ROW(), COLUMN())),0,-2)

Thanks for trying anyway mate. If anyone knows a way to condense it so it's simpler for someone else to read and understand, I'm all ears.
 
Upvote 0
How about
Excel Formula:
=INDEX(6:6,,COLUMN()-1)-INDEX(6:6,,COLUMN()-2)
 
Upvote 0
Solution
Found it.

This is what I want.

Excel Formula:
=OFFSET(INDIRECT(ADDRESS(ROW(), COLUMN())),0,-1)-OFFSET(INDIRECT(ADDRESS(ROW(), COLUMN())),0,-2)
Simpler to use:
Excel Formula:
=INDIRECT("RC[-1]",0)-INDIRECT("RC[-2]",0)
 
Upvote 0
Some more options:

Book1
RSTU
1Amt1Amt22 minus 1
21000100-900Current formula
31000100-900Offset
41000100-900Index
Sheet1
Cell Formulas
RangeFormula
T2T2=OFFSET(INDIRECT(ADDRESS(ROW(), COLUMN())),0,-1)-OFFSET(INDIRECT(ADDRESS(ROW(), COLUMN())),0,-2)
T3T3=OFFSET(T3,0,-1)-OFFSET(T3,0,-2)
T4T4=INDEX($A4:$T4,0,COLUMN()-1)-INDEX($A4:$T4,0,COLUMN()-2)
 
Upvote 0

Forum statistics

Threads
1,215,360
Messages
6,124,489
Members
449,166
Latest member
hokjock

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