RE: Need to be able segregate units run in excel sheet using time.

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



I am not sure I understand: When you say "units ran within an hour" are you
using the word "run" as in running your query, or do you mean something to do
with the process you are measuring (i.e. the time these "units" were actually
produced)?

If the former, basically you want to add a time stamp to your query. That
could be done in a few ways, probably the easiest is to add a calculated
field to your query. The form of the function you would use will depend on
your database driver and SQL version, but the following works with
Jet/MSAccess:

SELECT A, B, C, Now() as TimeStamp FROM MYTABLE ...

This appends a field with the time the query was run as a column in my
results table.

If you need information about some time value associated with the data in
your table, though, you can't get Excel to do that for you if it is not there
in the table. Unless there is a data field with the time you are looking
for, or some sort of time stamp on the records that is made accessible to an
outside query engine, there is nothing Excel (or any 3rd party app) can do -
this would be an issue for the database end, not the Excel end.

"Jim Ferguson" wrote:

> I have a spread*** that gets data from using an SQL statement this is
> updated with a macro and button so it can be refreshed at any time as this
> info is time critical.
>
> I want to be able to separate the units ran within an hour by filler and
> unit size.
> I know how to do the above but can't find any info on how to download info
> by the hour.
> ie need to know how many units ran from 06:00 to 07:00.
> When looking at the info from the database I can't find any reference to time.
>
> I am not an expert on SQL or Macros so need help.
>
> Can I use a macro to retrieve the data by the hour and if so how.
> Would it be better to extend my SQL statement is so how.
>
>
.


Quantcast