Thread: adjusting sums
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
smartin smartin is offline
external usenet poster
 
Posts: 915
Default adjusting sums

ericaamousseau wrote:
I was not sur if there was a way to have a formula move cells as you type. I
am not explaining it right, but say I have a spreadsheet for weight loss for
a group of people if the begginging weight is in cell A1 and the next week's
weight is in B1 and week after that is in C1 can I have the subtraction
"follow" the numbers to show weight lost each week? :

A1 B1 Formula
196 194 2

next week would be

A1 B1 C1 Formula
196 194 190 4

So that when I typed in C1 the formula shifted so as to ignor A1 and
subtract C1 from B1. Is this possible? thanks!


This will "follow" your data entry by looking for the right-most entry
on the row and subtracting it from the penultimate entry.

This is an array formula, so you must press Ctrl+Shift+Enter (not just
Enter) after you are done typing:

=INDEX($A1:$C1,1,MAX(($A1:$C1<0)*COLUMN($A1:$C1))-1)-INDEX($A1:$C1,1,MAX(($A1:$C1<0)*COLUMN($A1:$C1)))

You will likely need to adjust the "$C1" references to match the
right-most column where you will enter data.

Another way (much simpler) would be to add a formula in B2 like

=B1-A1

Fill right, then just look at the values.