Get Recent Date

Parra

Well-known Member
Joined
Feb 21, 2002
Messages
752
I want to create a query that will give me only the data for the most current date in the table

So if I have a table with the following dates:
1/1/03
1/1/03
1/9/03
2/2/03
2/10/03
The query will automatically choose 2/10/03.

Any suggestions?
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Could you simply create a query that sorts the records descending by date, then set the query properties to return only 1 record?

This would be the record with the most recent date.

Now if you had several records with that date, you'd still only get the one, but it's a start.

If you need all records with the most recent date. Build another query and use the date from this query to find all the records with that date.
 
Upvote 0
There are many records that have the most current date I am looking for.

What I need is a expression to enter into the criteria. Something like:

=Date(most current)
=Date(top)

I need something, that will extract the newest date in the field.

Thanks
 
Upvote 0
Create the first query to find the most recent date:

qryMostRecent
SELECT DISTINCT TOP 1 Table1.PurchaseDate
FROM Table1
ORDER BY Table1.PurchaseDate DESC;


Create another query to join on that date:

qryAllRecordsWithMostRecent
SELECT Table1.*
FROM Table1 INNER JOIN qryMostRecent ON Table1.PurchaseDate=qryMostRecent.PurchaseDate;



When you execute the second query, only those records with the most recent date will be shown.
 
Upvote 0

Forum statistics

Threads
1,221,497
Messages
6,160,152
Members
451,625
Latest member
sukhman

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top