autofilter with range of partial dates

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,
I'm trying to code an autofilter to retrieve the people having there
anniverseray this from today up to 7 days.
Date are organized as yyyy-mm-dd in the column.
I'm not able to set working the autofilter like criteria1 > "????-07-16" and
criteria2 < "????-07-23" for ex.

Where is the solution.
Many thnaks to all of you.
 
Hi Francois

I'm not sure whether you are putting ???? into your criteria or not, but if
you are then autofilter won't work.
Try setting criteria 1 to greater than or equal to 2004-07-16 and criteria 2
to less than or equal to 2004-07-23.

If you do need the data across a range of years, set up a helper column with
a formula =YEAR(A1) (assuming your dates are in column A) and then also
filter on this column for the years required.
 
Thanks Roger,
Yes the purpose of the yyyy was to cover all the years as for anniversary
only month & days are important.
So autofilter will not work with ???? ?
I assume then that I need to fill a column with only "mm-dd" information to
be able to solve this ?.
 
Hi Francois

I was only half awake when responding to your original post!!!
I think the best solution would be to use Advanced Filter instead of
Autofilter.

Assuming your dates are in column A, beginning in row 2 and that your data
is only within columns A to E.

In cell F2 =MONTH(A2)=7
In cell G2=DAY(A2)>=16
in cell H2=DAY(A2)<=23

Mark your block of data.
Data=>Filter=>Advanced Filter
Criteria=F1:H2

This will give a filtered list of data between 16th July and 23rd July
regardless of year.

For more instruction on the use of Advanced Filters take a look at Debra
Dalgleih's site
http://www.contextures.com/xladvfilter01.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top