Consulting

Results 1 to 10 of 10

Thread: autofilter with a cell as the criteria

  1. #1

    autofilter with a cell as the criteria

    Hi
    I would like to be able to use an custom auto filter using the information from a static cell as the criteria.

    Example; column a = order number
    b = description
    c = date (dd/mm/yy)

    cell d1 will have a date - will be changed often

    i would like to autofilter the date column 'C' but using the data in cell D1 as the filter criteria

    Ideally I would like to use the <= value in D1

    Any help will be appreciated

    regards

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Quote Originally Posted by wibbers2000
    Hi
    I would like to be able to use an custom auto filter using the information from a static cell as the criteria.

    Example; column a = order number
    b = description
    c = date (dd/mm/yy)

    cell d1 will have a date - will be changed often

    i would like to autofilter the date column 'C' but using the data in cell D1 as the filter criteria

    Ideally I would like to use the <= value in D1

    Any help will be appreciated

    regards
    If you mean without VBA, then take a look at Data>Filter>Advanced Filter.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3

    doesnt work

    I am unable to get the filter to use the cell D1 for reference, so i think it would have to be done via VBA.

    However, I would love to be proved wrong as filters are new to me.

    regards

  4. #4
    hi...

    autofilter as opposed to advancedfilter doe not allow an "external" reference...

    you may generate some "custom views" and store you criteria there...

    then you will be able to edit them as you like and use them as you like without having to switch between "show all" and your new criteria..

    best,
    wolfgang

  5. #5
    Sorry Wolfgang

    I am still unable to do what I want...

    1. If it use auto filter, I can then select the drop down arrow and choose custom. I the select the <= XXXX (XXXX being the date). This will display the rows I want

    2. If I use advance filter, I get nothing... I cant get it to use a cell value for the filter criteria.

    What I want to do is just as point one, but without have to go through all the steps. I would like the criteria to be entered in cell D1 and then the macro/autofilter/VBA to use that value.

    I just want to put a button on the page and link it to a macro etc rather than have the users try and figure out filters

    thanks for your advice anyway I will be looking into advanced filters in more depth.

    regards

  6. #6
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Quote Originally Posted by wibbers2000
    Sorry Wolfgang

    I am still unable to do what I want...

    1. If it use auto filter, I can then select the drop down arrow and choose custom. I the select the <= XXXX (XXXX being the date). This will display the rows I want

    2. If I use advance filter, I get nothing... I cant get it to use a cell value for the filter criteria.

    What I want to do is just as point one, but without have to go through all the steps. I would like the criteria to be entered in cell D1 and then the macro/autofilter/VBA to use that value.

    I just want to put a button on the page and link it to a macro etc rather than have the users try and figure out filters

    thanks for your advice anyway I will be looking into advanced filters in more depth.

    regards
    In advanced filter, put the column heading in a cell, link to that date cell in the cell below, and define both as the criteria.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  7. #7
    don't give up so early..........

    i attach an example workbook, if i am able to do so....

    then please have a look and good luck...

    best,
    wolfgang

  8. #8
    thanks XLD

    I got the advance filter to work.

    Is there a way to filter bewteen a range of dates or <= to date.

    --I am beginning to think that I may need to look at a loop process to search the rows for date <= and the copy that row and paste into a new sheet and then repeat the loop until all rows have been checked.

    regards
    wibbers

  9. #9
    Can't you use the advanced filter to do the date range too:

    e.g.
    D1 Start Date
    E1 End Date

    F1 blank
    F2 =and(c2 >=$d$1, C2 <=$e$1)

    where C2 = first entry in date column

    Then setup the advanced filter using $F$1:$F$2 as the criteria range.

    You can refresh the filter using a button running a macro or when the sheet changes etc. using something like:

    Range("DataRangeName").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:= Range("Criteria")

    Steve

  10. #10
    Quote Originally Posted by dragon-it
    Can't you use the advanced filter to do the date range too:

    e.g.
    D1 Start Date
    E1 End Date

    F1 blank
    F2 =and(c2 >=$d$1, C2 <=$e$1)

    where C2 = first entry in date column

    Then setup the advanced filter using $F$1:$F$2 as the criteria range.

    You can refresh the filter using a button running a macro or when the sheet changes etc. using something like:

    Range("DataRangeName").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:= Range("Criteria")

    Steve
    thanks Steve

    that is perfect... just going to add a couple of input boxes to update the date range cells and it will do just as requested.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •