View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ron Rosenfeld Ron Rosenfeld is offline
external usenet poster
 
Posts: 5,651
Default Finding Nearest and Furthest Date

On Mon, 20 Aug 2007 09:30:05 -0700, carl
wrote:

My data table is like so. My date format is YY/M

Today 7-Aug

Stock Date
SPY 7-Oct
SPY 7-Dec
SPY 10-Dec
OIH 7-Aug
OIH 9-Jan

Trying to create this table. Basically I am trying to find the date in the
data table that is the closest and furthest away from today's date.

DateMax DateMin
SPY 10-Dec 7-Oct
OIH 9-Jan 7-Aug

Thank you in advance.




You could use a Pivot Table.

Below is the result I got with your data

Stock DateMax DateMin
OIH 9-Jan 7-Aug
SPY 10-Dec 7-Oct

I dragged Stock to the Rows Area
I dragged Date to the Data area, and changed the field setting to Min of Dates,
renaming DateMin
I dragged Date to the Data area (again), and changed the field setting to Max
of Dates, renaming DateMax

I then selected a report format that was similar to what you used above.




--ron