On Wed, 3 Mar 2010 16:26:01 -0800, May 1950rc <May
I have a column; some cells contain numbers and other cells are blank. I
keep adding numbers and blanks. How do I create a formula that will
automatically calculate the sum of the last 5 numbers every time I add a
number.
Thank you
I am assuming you wish to ignore the blanks.
In the formula, rng represents, for example, A1:A100. In Excel 2007 or higher,
rng can represent an entire column (e.g. A:A); but in earlier versions of
Excel, it must be less than a full column (e.g. A1:A65535).
Larger rng's will take longer to calculate, so use some reasonable size, or use
a dynamic formula to define it.
This formula must be **array-entered**:
=SUM(LOOKUP(LARGE(ISNUMBER(rng)*ROW(rng),{1,2,3,4,5}),ROW(rng),rng))
----------------------------------------
To **array-enter** a formula, after entering
the formula into the cell or formula bar, hold down
<ctrl><shift> while hitting <enter>. If you did this
correctly, Excel will place braces {...} around the formula.
--ron