Simple FILTER problem

sharshra

Active Member
Joined
Mar 20, 2013
Messages
413
Office Version
  1. 365
I have a table where I have to filter the ctg column having 'imp' or 'prd'. I tried doing this using formula, but not getting the correct results. I'm sure I must have done a silly mistake :unsure: Can the experts help please?

Source table:
excel problems.xlsx
BCDE
54#descnamectg
552fsdfsfimp
5698ewqebn
57s-5nmnui
5843vcvcbcvprd
59v1ewewwimp
filter


Desired output:
excel problems.xlsx
GHIJ
54#descnamectg
552fsdfsfimp
5643vcvcbcvprd
57v1ewewwimp
filter


Error using FILTER function:
excel problems.xlsx
L
55#CALC!
filter
Cell Formulas
RangeFormula
L55L55=LET( all,$B$55:$E$59, ctg, $E$55:$E$59, f, FILTER(all, (ctg="imp")*(ctg="prd")), f)
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
You need + for OR. * is equivalent to AND - so:

Excel Formula:
=LET(all,$B$55:$E$59, ctg, $E$55:$E$59,f, FILTER(all, (ctg="imp")+(ctg="prd")),f)
 
Upvote 0
Thanks for the quick reply, @RoryA (y) It works perfectly. Just one hitch :unsure: In the output, blank cell is replaced by zero. How to avoid this? If it is blank, I need blank only in the output.
excel problems.xlsx
LMNO
552fsdfsf0imp
5643vcvcbcvprd
57v1ewewwimp
filter
Cell Formulas
RangeFormula
L55:O57L55=LET( all,$B$55:$E$59, ctg, $E$55:$E$59, f, FILTER(all, (ctg="imp")+(ctg="prd")), f)
Dynamic array formulas.
 
Upvote 0
You can work around that with:

Excel Formula:
=LET(all,$B$55:$E$59, ctg, $E$55:$E$59,f, FILTER(all, (ctg="imp")+(ctg="prd")),IF(f="","",f))
 
Upvote 0
Solution

Forum statistics

Threads
1,225,757
Messages
6,186,848
Members
453,379
Latest member
gabriellegonzalez

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