View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max Max is offline
external usenet poster
 
Posts: 9,221
Default select only last 30 days of a work sheet

Something along these lines might deliver it here ..

Let's say you want to dynamically extract the last (ie "lowest") 7 lines of
source data into another sheet, based on a key col, where the key col would
contain contiguous source data populated down (ie with no empty cells
in-between data)

Source data assumed in Sheet1, cols A to G, col headers in row1, data in
row2 down, with key col A (date). It's assumed there's at least 7 lines of
source data to start with.

In Sheet2,
with the same col headers pasted in A1:G1

Place this in A2:
=OFFSET(INDIRECT("'Sheet1'!A"&COUNTA(Sheet1!$A:$A)-6),MOD(ROWS($1:1)-1,7),COLUMNS($A:A)-1)

Copy A2 across to G2, fill down to G8. Format the cols accordingly. A2:G8
will dynamically return the last 7 lines of source data in Sheet1 as source
data is continuously populated there.

Adapt to suit the number of lines desired:
in ..COUNTA(Sheet1!$A:$A)-6 : the "6" is 7 lines -1
in ..MOD(ROWS($1:1)-1,7) : the 7 = 7 lines
--
Max
Singapore
http://savefile.com/projects/236895
Downloads:22,000 Files:370 Subscribers:66
xdemechanik
---
"Tyler" wrote:
I need to filter out only the last x number of days/hours of data from my
work sheet. The worksheet posts new data every 5 minutes. I need to extract
the newest data points. The time will vary from 7 days to 90 days.

My existing data has a date/time combination. It looks like
this,"12/19/2008 19:10"