View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Macro to find matching date and copy values to another sheet

A formula might suffice ..

Illustrated in this sample:
http://www.flypicture.com/download/MjYwNw==
Extract n Transpose data by date into another sht.xls

In dailydata,
Data is presumed logged like this (below) down cols A to C,
with dates in col A,
corresponding run-times placed 2 rows below in cols A to C

3-Jul-07
Start End time
1 7 6


4-Jul-07
Start End time
4 5 9


and so on

In datamonth,
dates are running in B1 across

Put in B2:
=OFFSET(INDIRECT("dailydata!A"&MATCH(B$1,dailydata !$A:$A,0)+2),,ROWS($1:1)-1,)
Copy B2 down to B4, fill across as far as required

Perhaps slightly better with a simple IF check on the dates in B1 across,
you could use in B2:
=IF(B$1="","",OFFSET(INDIRECT("dailydata!A"&MATCH( B$1,dailydata!$A:$A,0)+2),,ROWS($1:1)-1,))
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"Tiger" wrote:
I have 2 spreadsheets, dailydata and datamonth. I need a macro which looks up
the date in dailydata which is in a fixed location, and then finds the
matching date in datamonth across a row of monthly dates (e.g. 01 jul to 31
jul) and pastes values from dailydata below the matching date in datamonth.

dailydata
3-Jul-07
Start End time
1 7 6


Datamonth
Dates 2-Jul-07 3-Jul-07 4-Jul-07
Start Run
End Run
Run Time

Thanks Heaps