ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Filling Database Query (https://www.excelbanter.com/excel-programming/308651-filling-database-query.html)

stuph[_3_]

Filling Database Query
 
I have a database Query that generates information as follows:

Date, Day of the Week, Hour Day, Value1, Value2


The problem is that since it's a database query, if there's n
inforamtion for a particular hour of the day, it just skips over tha
hour.

Like so:

8/3/2004, 3, 2, 100, 700
8/3/2004, 3, 3, 150, 845
8/3/2004, 3, 4, 231, 101
8/3/2004, 3, 6, 171, 842

What I need is a macro to cycle through and fill in places where ther
is no data.. so the above would turn in to:

8/3/2004, 3, 2, 100, 700
8/3/2004, 3, 3, 150, 845
8/3/2004, 3, 4, 231, 101
8/3/2004, 3, 5, 0, 0
8/3/2004, 3, 6, 171, 842

This is also for multiple days, so at midnight it goes from
8/3/2004, 3, 23, 104, 543

to

8/4/2004, 3, 0, 78, 163

Any pointers on how to get started

--
Message posted from http://www.ExcelForum.com


Tom Ogilvy

Filling Database Query
 
loop through your data row by row
for each row, compute what you expect the next row to contain. If it
doesn't, insert a row before it and write in the values. Move to the next
row (which would be the new row if you added one) and repeat). Not sure
what you would want for value1 and value2.

--
Regards,
Tom Ogilvy

"stuph " wrote in message
...
I have a database Query that generates information as follows:

Date, Day of the Week, Hour Day, Value1, Value2


The problem is that since it's a database query, if there's no
inforamtion for a particular hour of the day, it just skips over that
hour.

Like so:

8/3/2004, 3, 2, 100, 700
8/3/2004, 3, 3, 150, 845
8/3/2004, 3, 4, 231, 101
8/3/2004, 3, 6, 171, 842

What I need is a macro to cycle through and fill in places where there
is no data.. so the above would turn in to:

8/3/2004, 3, 2, 100, 700
8/3/2004, 3, 3, 150, 845
8/3/2004, 3, 4, 231, 101
8/3/2004, 3, 5, 0, 0
8/3/2004, 3, 6, 171, 842

This is also for multiple days, so at midnight it goes from
8/3/2004, 3, 23, 104, 543

to

8/4/2004, 3, 0, 78, 163

Any pointers on how to get started?


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 11:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com