+ Reply to Thread
Results 1 to 22 of 22

Optional FILTER in FILTER() Function

  1. #1
    Registered User
    Join Date
    01-12-2021
    Location
    Munich
    MS-Off Ver
    MS365
    Posts
    19

    Optional FILTER in FILTER() Function

    Hello Friends,

    I am back with another question for my Excel Project.

    My Excel Worksheet uses =FILTER() Functions to get some data based on two criterias out of a larger table.

    I would like to include a Field/ Dropdown with Names of Persons as an optional choice which should influence my FILTER function.
    So basically a third optional criteria (Consider it if I choose something, dont consider it if empty.)

    My current Function
    Please Login or Register  to view this content.
    What I would like to add
    Dropdown: NAMES
    If there is a name in the dropwdown selected the function should adjust and check for the NAME and if I dont select a NAME the function should run as before.

    Hope the explanation is somewhat clear.

    Thank you very much for your help!
    Attached Files Attached Files
    Last edited by Yohnson; 07-06-2021 at 08:54 AM. Reason: Added Worksheet

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Optional FILTER in FILTER() Function

    Please upload a workbook or a representative cut down copy, anonymised if necessary. It is always easier to advise if we can see your request in its context.

    Show a before and after situation with manually calculated results, explaining which information is data and which is results, and if it's not blindingly obvious how you have arrived at your results some explanatory notes as well.

    To upload a file click the Go Advanced button at the foot of your post, look underneath the post area for the Manage Attachments section and take it from there.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,916

    Re: Optional FILTER in FILTER() Function

    If you have the FILTER function, then your version is MS365, NOT Excel 2019 - please update your profile.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  4. #4
    Registered User
    Join Date
    01-12-2021
    Location
    Munich
    MS-Off Ver
    MS365
    Posts
    19

    Re: Optional FILTER in FILTER() Function

    Thanks for the Input.

    I added a very brief Example table to my Thread and hope that it is enough to understand the problem.

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,916

    Re: Optional FILTER in FILTER() Function

    Try this:

    =FILTER(Tabelle1[Customer];(Tabelle1[Revenue Start]>=Tabelle3!A4)*(Tabelle1[Revenue End]<=Tabelle3!B4)*(Tabelle1[Owner]=WENN(Tabelle3!D4<>"";Tabelle3!D4;"*"));"")

    Not tested, as your sample file is not complete enough to allow testing (no source data provided).

  6. #6
    Registered User
    Join Date
    01-12-2021
    Location
    Munich
    MS-Off Ver
    MS365
    Posts
    19

    Re: Optional FILTER in FILTER() Function

    That works when I have Input in my D4 Owner Field but not when it is empty.

    Do you mind giving me a short explanation about the last part?

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,916

    Re: Optional FILTER in FILTER() Function

    As I said, it's not tested, so there's not much point unless we can make it work. It's just a basic IF clause, anyway, and I am sure you understand those.

    Provide a better sample workbook that I can test it on. Maybe D4 is not really empty ... So many things could be at play here.

  8. #8
    Registered User
    Join Date
    01-12-2021
    Location
    Munich
    MS-Off Ver
    MS365
    Posts
    19

    Re: Optional FILTER in FILTER() Function

    It is way to much to provide the Data or make an example but this is basically the sheet I am working in without the Data Source.

    If I use your suggested function I can enter Owner Names and my table will adjust but I cannot leave it blank.
    Attached Files Attached Files

  9. #9
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,916

    Re: Optional FILTER in FILTER() Function

    That's even less use!

    Sorry - I cannot help without seeing something more realistic.

    Simply provide a cut-down version of your file INCLUDING source data with sensitive data desensitised. Don't expect me to concoct dummy data on your behalf.

    You are getting FREE help here - it it's too much trouble for you to provide the requisite sample data, then it's certainly too much trouble for me to bother wasting my time on it. Sorry.

  10. #10
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,063

    Re: Optional FILTER in FILTER() Function

    Mock up a sample of a handful of rows with A, B, C instead of names, etc. No-one wants to see your real data... but SOMETHING to go on would be useful!!
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  11. #11
    Registered User
    Join Date
    01-12-2021
    Location
    Munich
    MS-Off Ver
    MS365
    Posts
    19

    Re: Optional FILTER in FILTER() Function

    New Worksheet attached!
    Attached Files Attached Files

  12. #12
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,916

    Re: Optional FILTER in FILTER() Function

    Try this:

    =FILTER(Tabelle1[Customer],(Tabelle1[Revenue Start]>=Tabelle3!A4)*(Tabelle1[Revenue End]<=Tabelle3!B4)*(IF(Tabelle3!D4="",1,Tabelle1[Owner]=Tabelle3!D4)),"")

    Replace commas with semi-colons and IF with WENN:

    =FILTER(Tabelle1[Customer];(Tabelle1[Revenue Start]>=Tabelle3!A4)*(Tabelle1[Revenue End]<=Tabelle3!B4)*(WENN(Tabelle3!D4="";1;Tabelle1[Owner]=Tabelle3!D4));"")
    Attached Files Attached Files
    Last edited by AliGW; 07-06-2021 at 09:47 AM.

  13. #13
    Registered User
    Join Date
    01-12-2021
    Location
    Munich
    MS-Off Ver
    MS365
    Posts
    19

    Re: Optional FILTER in FILTER() Function

    Very cool, thanks a lot!

  14. #14
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,916

    Re: Optional FILTER in FILTER() Function

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

  15. #15
    Registered User
    Join Date
    01-12-2021
    Location
    Munich
    MS-Off Ver
    MS365
    Posts
    19

    Re: Optional FILTER in FILTER() Function

    I am still working on the same Excel-Sheet and I am now struggling with additional conditional filters.

    The current Solution
    Please Login or Register  to view this content.
    It works very well but I would like to add another WENN() / IF () Statement that is conditional.
    I tried the following:

    Please Login or Register  to view this content.
    Thank you very much for your help!
    Last edited by Yohnson; 07-08-2021 at 05:37 AM.

  16. #16
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,063

    Re: Optional FILTER in FILTER() Function

    Please attach a sheet so that we an SEE what you have.

  17. #17
    Registered User
    Join Date
    01-12-2021
    Location
    Munich
    MS-Off Ver
    MS365
    Posts
    19

    Re: Optional FILTER in FILTER() Function

    The File is basically the same as before.

    I just added two more cells with Filter options which I would like to include in the Formula.

    Please see attached.
    Attached Files Attached Files

  18. #18
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,063

    Re: Optional FILTER in FILTER() Function

    Is this what you wanted???


    =FILTER(Tabelle1[Customer],(Tabelle1[Revenue Start]>=Tabelle3!A4)*(Tabelle1[Revenue End]<=Tabelle3!B4)*(Tabelle1[Owner]=Tabelle3!D4))
    Attached Files Attached Files

  19. #19
    Registered User
    Join Date
    01-12-2021
    Location
    Munich
    MS-Off Ver
    MS365
    Posts
    19

    Re: Optional FILTER in FILTER() Function

    Not really.

    So the current solution filters based on the D4 Owner Imput (If empty just list all results between the dates / if filled out, give me all results based on the dates and the owner)

    =FILTER(Tabelle1[Customer];(Tabelle1[Revenue Start]>=Tabelle3!A4)*(Tabelle1[Revenue End]<=Tabelle3!B4)*(WENN(Tabelle3!D4="";1;Tabelle1[Owner]=Tabelle3!D4));"")

    I now want to include two more "optional filters": Target & Top Prio
    If they are empty, there is no need to consider them. If they are filled with a value I want only the results that also fulfill these filters.

  20. #20
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,063

    Re: Optional FILTER in FILTER() Function

    You said "If they are empty" where? If the cells in sheet Tabelle 3 are blank?? Or in the main table. You are not providing a detailed explanation.

  21. #21
    Registered User
    Join Date
    01-12-2021
    Location
    Munich
    MS-Off Ver
    MS365
    Posts
    19

    Re: Optional FILTER in FILTER() Function

    The logic behind the table should work like that:

    1. I have a large Table with Data (NEW WIP - WorkSheet)
    2. This Data should be filtered between two Dates (A4 / B4) giving me the following results: Customer, Owner, Topic... => From New WIP
    3. In addition I want to include OPTIONAL Filters => Idea: Three Cells (Top of Tabelle 3) that I can fillout with Names or Keywords which are included in NEW WIP Columns similar to a Pivot Filter that influence my Output between the Dates.

    Maybe I want to filter by Owner, maybe I want to filter by Owner + Target (Both are Columns in New WIP).
    If I put something in the cells D4-F4 the results should be filtered based on these values and if NOT - dont consider them.

  22. #22
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,916

    Re: Optional FILTER in FILTER() Function

    I think you'll need this sort of structure:

    =FILTER(Tabelle1[Customer];(Tabelle1[Revenue Start]>=Tabelle3!A4)*(Tabelle1[Revenue End]<=Tabelle3!B4)*((WENN(Tabelle3!D4="";1;Tabelle1[Owner]=Tabelle3!D4)+(WENN(Tabelle3!D4="";1;Tabelle1[Owner]=Tabelle3!D4)+(WENN(Tabelle3!D4="";1;Tabelle1[Owner]=Tabelle3!D4)));"")

    Change the red and blue sections for your extra criteria.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Filter function in Office 365 - filter with designated field
    By Eric Tsang in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 03-28-2020, 10:55 AM
  2. Inserting filter into pivot table via macro errors if filter doesn't exist.
    By taylorsm in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-03-2018, 10:24 AM
  3. Macro to filter a pivot whilst looping through filter criteria in a variable list.
    By Alistairm88 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-29-2015, 04:25 AM
  4. Need to filter a report filter based on the previous filter
    By elliotencore in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 01-28-2014, 07:44 AM
  5. Change Pivot table Filter Based on Cell Value *Multiple Filter items* Possible?
    By Flydd in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-27-2012, 06:57 AM
  6. Filter several pivot tables by one programmed date range filter in Excel 2003
    By olewka in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-08-2011, 11:49 AM
  7. [SOLVED] advanced filter a range:Advanced Filter function
    By Il Principe in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 10:05 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1