Filter Formula to exclude everything except one value

hananak

Board Regular
Joined
Feb 10, 2022
Messages
110
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Dear All,

I am trying to do do a lookup based on two criteria, if the criteria matches, then it should not give all the results but the result I want. I tried various formulas on internet on Xlookup but not working and then I came across Filter function which is close to what I want but still not able to get the desired outcome.

Please see the attached picture, to see if that is possible.

Your expert advice will be appreciated.
 

Attachments

  • Picture1.png
    Picture1.png
    206.2 KB · Views: 13
Try:
Book1
ABCDEFGHIJ
1
2
3Cost CodeEmployeeAllowancesColumn 4Cost Code
4124511068246Allowance 1Something1297EmployeeAllowances
5124511068246Allowance 2Something11068246Allowance 4
6124511068246Allowance 3SomethingEmployee No11068246Allowance 3
7124511068246Allowance 4Something11068246
8129710903301Allowance 1Something
9129710903301Allowance 2Somethingnot found
10129710903301Allowance 3Something
11129710903301Allowance 4Something
12129710903301Allowance 5Something
13129710903301Allowance 6SomethingEmployee No
14129710903301Allowance 7Something10903301
15129710903301Allowance 8Something
16Allowance 1
17Allowance 2
18Allowance 3
19Allowance 4
20Allowance 5
21Allowance 6
22Allowance 7
23Allowance 8
Sheet2
Cell Formulas
RangeFormula
F9,F16:F23F9=LET(u,UNIQUE(VSTACK(Table1[[Cost Code]:[Allowances]],HSTACK(EXPAND("",ROWS(Exclude),,""),Exclude)),,1), FILTER(CHOOSECOLS(u,3),(CHOOSECOLS(u,2)=F7)*(CHOOSECOLS(u,1)=$F$4),"not found"))
The formula is not excluding the allowances, despite populating the exclusion list (column I and J), rest is working.

please see the picture.
 

Attachments

  • Picture1.png
    Picture1.png
    249.8 KB · Views: 3
Upvote 0

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Sorry, the formula is now giving totally opposite. instead of giving me everything, it now gives what is being added to the Exclusion list.
 
Upvote 0
Ignore post#19 it doesn't consider the Exclude list and this is shorter.
Book1
ABCDEFGHIJ
1
2
3Cost CodeEmployeeAllowancesColumn 4Cost Code
4124511068246Allowance 1Something1245EmployeeAllowances
5124511068246Allowance 2Something11068246Allowance 4
6124511068246Allowance 3SomethingEmployee No11068246Allowance 3
7124511068246Allowance 4Something11068246
8129710903301Allowance 1Something
9129710903301Allowance 2SomethingAllowance 1
10129710903301Allowance 3SomethingAllowance 2
11129710903301Allowance 4Something
12129710903301Allowance 5Something
13129710903301Allowance 6SomethingEmployee No
14129710903301Allowance 7Something10903301
15129710903301Allowance 8Something
16not found
Sheet2
Cell Formulas
RangeFormula
F9:F10,F16F9=LET(u,UNIQUE(VSTACK(FILTER(Table1[[Employee]:[Allowances]],Table1[Cost Code]=$F$4,""),Exclude),,1), FILTER(CHOOSECOLS(u,2),(CHOOSECOLS(u,1)=F7),"not found"))
Dynamic array formulas.
Thank you very much Cubist. I really appreciate the efforts and time you have put in resolving my query and all those quick responses. Awesome!!! I can't thank enough! :)
 
Upvote 0

Forum statistics

Threads
1,224,813
Messages
6,181,117
Members
453,021
Latest member
Justyna P

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