I have a list of unique identifiers in column A. Each unique identifier that has a number of dates associated with it in column B. I would like to calculate the max date for each unique identifier. However, I do not want it to deliver the oldest date as the max if it is an outlier. In this case if the max under the initial calculation is more than 180 days older then the next oldest date (it is considered an outlier) and I would it to return the second oldest value.


Unique ID Dates
aaa3546 3/1/08
aaa3546 4/16/08
aaa3546 12/31/08

The typical max function would return 12/31/08. Since there is more than 180 days between 12/31/08 and 4/16/08, I would like it to return 4/16/08. Any ideas would be appreciated.