Sum only last X cells

G

Guest

I have a worksheet where I add every week a column with numbers. I insert a
new column for the new week and the next cell has a formula that sums only
the last four cells.

The thing is that when I insert the column, the sums stays refering to the
previous 4 and does not consider the new one. I need this sum to consider
ONLY the last 4 coulmns to te left of that, any ideas? Can you refer
dynamicaly to the previous 4 cells in order to sum them??

Thanks in advance,
Rds, from Argentina
Ignacio
 
B

Bob Phillips

Hi Ignacio,

This works for row 1, assuming that the data starts in A1

=SUM(OFFSET(A1,,COUNTA(1:1)-4,,4))

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
G

Guest

Let me give an example:

I have the total in the right,

A B C D E
1 8 1 5 15

So when i add a column between E and D, i want the sum to be from B to E

Clearer now?

Rds, and many thanks
Ignacio
 
B

Bob Phillips

That is nothing like what you originally asked.

=SUM(OFFSET(A1,,COUNT(A1:OFFSET(E1,,-1))-4,,4))
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top