# Adding the last 8 days of data

K

#### kcholly

I have cols. for each day of the month starting with the 1st.. In col A is
the grand total of the last 8 days of data. How would I create a formula to
add the last 8 days of data automaticlly from todays date.
Ex. Col A...Col B........Col M
69 12 8.... 11

T

#### T. Valko

Not sure what the significance of today's date has to do with it.

If you enter data daily then from tomorrows date to the end of the month
there will be no data. Is that correct? If so, then don't you just need the
*last* 8 entries in the row? Also, today's date is 8/4 so there aren't 8
entries for the month, right?

K

#### Kcholly

What you just stated is correct. To make myself clear,
I would need the data for the following:
July 28, July 29, July 30, July 31,....Aug 4. Then
Tomorrow's data would be from July 29..............Aug 5.

T

#### T. Valko

Try this array formula** :

=SUM(AF2:INDEX(B2:AF2,LARGE((COLUMN(B2:AF2)-COLUMN(B2)+1)*(B2:AF2<>""),8)))

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER). Hold down both the CTRL key and the SHIFT
key then hit ENTER.

That will sum the last 8 entries in the range. If there are less than 8
entries it will sum whatever's there.

Adjust for the correct end of range. I've assumed AF2 would be for the last
day of the month in a 31 day month.

K

#### kcholly

Thanks, worked like a charm...........

T. Valko said:
Try this array formula** :

=SUM(AF2:INDEX(B2:AF2,LARGE((COLUMN(B2:AF2)-COLUMN(B2)+1)*(B2:AF2<>""),8)))

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER). Hold down both the CTRL key and the SHIFT
key then hit ENTER.

That will sum the last 8 entries in the range. If there are less than 8
entries it will sum whatever's there.

Adjust for the correct end of range. I've assumed AF2 would be for the last
day of the month in a 31 day month.

T

#### T. Valko

You're welcome. Thanks for the feedback!