View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max Max is offline
external usenet poster
 
Posts: 9,221
Default how do I copy the last 20 entries in an expanding list

I can't find a corresponding formula in excel

You could try this multi-cell array formula
Assume your source data is in A2:B2 down, contiguous & expected to vary up
to say, A2:B1000
Select a 20 cell col range, say D2:D21 (with D2 active)
Copy n paste this into the formula bar (ie for D2), then press
CTRL+SHIFT+ENTER to confirm the formula into D2:D21 at one go (ie multi-cell
array-enter):
=OFFSET(INDIRECT("A"&MAX(IF(A$2:A$1000<"",ROW(A$2 :A$1000)))),,COLUMNS($A:A)-1,-20)
Copy D2:D21 across to E21. D2:E21 will return the last 20 rows of the source
data in cols A and B as it expands up to row 1000. The formula monitors the
last filled cell in col A, then grabs 20 rows from there upwards (via the
"-20" height param in the OFFSET). Tested ok here. Success? hit the YES below
--
Max
Singapore
---
"DJA" wrote:
Within a macro, I need to copy the last 20 entries of a list to another
location.
as the list grows, I still only need the last 20 entries to copy to the
location.
in lotus I would write "end down" "up 20" then copy & move.

I can't find a corresponding formula in excel.

when I try using end down in the macro and copy... it seems to always use
the original space rather than the new space as new entries are listed.