FILTER Formula: Simultaneous AND and OR Conditions?

engrnoir

New Member
Joined
Mar 25, 2023
Messages
10
Office Version
  1. 365
Platform
  1. Windows
Is it possible to make my conditions in Filter Formula with both AND and OR (the condition for OR is multiple and dynamic)?
For example, I have a table:
DescriptionYearMonthType
Item 12023MarFruit
Item 22024MarFruit
Item 32025MarFruit
Item 42024MarVegetable
Item 52023JanFruit
Item 62024JanFruit
Item 72025JanFruit
Item 82024JanVegetable

Now in this data sample, I'm trying to use the Filter Formula where I can include items using both AND conditions and OR conditions.
I know how to use Multiple AND conditions [(X="value")*(Y="value2")*...], and OR conditions [(X = "value1")+(Y = "value 2") + ...], I just haven't had the opportunity to use both at the same time.

In this example, let's say I want to filter out all fruits, but I want to filter out all fruits in varying Year and Month (my data set will possibly have same type but will have singular or multiple months/years). My reference for the varying part is a text string of years/months separated by a comma (",") (i.e., 2023,2024,2025...; Jan,Feb,Mar...).
Input Values:
Sample 1:
Year: 2023,2024,2025
Type: Fruit
Month: Jan
Result should be Item 1, Item 2, and Item 3. The OR part comes in at the Year condition, while the AND part comes in at the Month (Mar) and Type (Fruit).

Sample 2:
Year: 2023
Type: Fruit
Month: Jan,Mar

Result should be Item 1, and Item 5. The OR part comes in at the Month (January OR March), while the AND part comes in at the Year (2023) and Type (Fruit).

I apologize in advance if I'm overthinking this or something along those lines, or if I didn't make my question clear. This is the first forum I've ever been in and I already appreciate everything I have seen here before. LOL
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

Forum statistics

Threads
1,215,073
Messages
6,122,970
Members
449,095
Latest member
Mr Hughes

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top