Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
"K Dales" wrote ...
I am pulling data out of an ODBC database into Excel using MS Query. I would like to write a criteria where the query includes only the previous 12 months of data (TODAY()-365). Is this possible? Yes, very possible and handy: First, in Excel, put your formula =(TODAY()-365) into a cell. Your database server should more accurately provide this info, rather than obtaining it locally e.g. Jet ('MS Access'): SELECT Now SQL Server: SELECT GetDate() You could use this in a query e.g. for Jet: SELECT RefID, DateEffective, Earnings FROM EarningsHistory WHERE DateEffective BETWEEN DateSerial(Year(Now)-1, Month(Now), Day(Now)) AND Now ; Jamie. -- |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Query criteria based on a changing criteria list | Excel Discussion (Misc queries) | |||
Update one worksheet tab to automatically update all other tabs? | Excel Worksheet Functions | |||
Can a macro be automatically run after an update from MS query? | Excel Discussion (Misc queries) | |||
Convert hard coded query criteria to Parameter Query | Excel Discussion (Misc queries) | |||
Update Query | New Users to Excel |