Filter Function - Ignore Criteria when blank

Glasgowsmile

Active Member
Joined
Apr 14, 2018
Messages
280
Office Version
  1. 365
Platform
  1. Windows
Hello,

I've got a filter formula that I'm using I noticed if any of the cells are blank (like L1, M1, N1, or O1) then I get a #calc error. Is there a way to ignore those criteria when the reference cells are blank?

Excel Formula:
=FILTER(A2:H412,(F2:F412=K1)*(H2:H412=L1)*(C2:C412=M1)*(A2:A412>=N1)*(A2:A412<=O1),)
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Please put "" at last.


=FILTER(A2:H412,(F2:F412=K1)*(H2:H412=L1)*(C2:C412=M1)*(A2:A412>=N1)*(A2:A412<=O1),"")
 
Upvote 0
One work-around is to place each of the array match expressions inside an IF statement and return 1 for any of the expressions where the K:O inputs are blank:
Excel Formula:
=FILTER(A2:H412,IF(K1="",1,(F2:F412=K1))*IF(L1="",1,(H2:H412=L1))*IF(M1="",1,(C2:C412=M1))*IF(N1="",1,(A2:A412>=N1))*IF(O1="",1,(A2:A412<=O1)),"")
 
Upvote 0
Solution
One work-around is to place each of the array match expressions inside an IF statement and return 1 for any of the expressions where the K:O inputs are blank:
Excel Formula:
=FILTER(A2:H412,IF(K1="",1,(F2:F412=K1))*IF(L1="",1,(H2:H412=L1))*IF(M1="",1,(C2:C412=M1))*IF(N1="",1,(A2:A412>=N1))*IF(O1="",1,(A2:A412<=O1)),"")
Thank you, this saved me a tremendous amount of time instead of doing IF statements for every possible combination.
 
Upvote 0

Forum statistics

Threads
1,215,222
Messages
6,123,717
Members
449,116
Latest member
Aaagu

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