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

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
try this:

Book1
ABCDEFGH
1EmployeeAllowances
210903301Standard Allowance50EmpAmount
310903301Allowance 11001090330150
410903301Allowance 220060
510903301Allowance 3300
610903301Allowance 4400
710903301Allowance 5500Allowance
810903301Allowance 6600Standard Allowance
910903301Allowance 7700
1010903301Standard Allowance60
1110903301Allowance 9900
1210903301Allowance 101000
13
Sheet13
Cell Formulas
RangeFormula
G3:G4G3=FILTER($C$2:$C$12,($A$2:$A$12=$E$3)*($B$2:$B$12=$E$8))
Dynamic array formulas.
 
Last edited:
Upvote 0
try this:

Book1
ABCDEFGH
1EmployeeAllowances
210903301Standard Allowance50EmpAmount
310903301Allowance 11001090330150
410903301Allowance 220060
510903301Allowance 3300
610903301Allowance 4400
710903301Allowance 5500Allowance
810903301Allowance 6600Standard Allowance
910903301Allowance 7700
1010903301Standard Allowance60
1110903301Allowance 9900
1210903301Allowance 101000
13
Sheet13
Cell Formulas
RangeFormula
G3:G4G3=FILTER($C$2:$C$12,($A$2:$A$12=$E$3)*($B$2:$B$12=$E$8))
Dynamic array formulas.
Thanks alot. It worked perfectly.
I need to learn this Filter formula, looks.like very can do so much with this.
 
Upvote 0
You're welcome.

Best Wishes.
Can you help me with this as well.

The data is in (Column B and C):

Column F, where I would like to extract the list based on the Employee no, the highlighted in yellow is where I would like to have formula.
Column I and J - is the exclusion list, where based on the Employee no and Allowance Description, it should filter the list in column F - cells highlighted in yellow.

If there is nothing for any employee on the exclusion list then it should return all the allowances for each employee on highlighted cells in column F.

Please see the attachment.

Your help would be really apprecaited.
 

Attachments

  • Picture1.png
    Picture1.png
    185 KB · Views: 5
Upvote 0
Can you help me with this as well.

The data is in (Column B and C):

Column F, where I would like to extract the list based on the Employee no, the highlighted in yellow is where I would like to have formula.
Column I and J - is the exclusion list, where based on the Employee no and Allowance Description, it should filter the list in column F - cells highlighted in yellow.

If there is nothing for any employee on the exclusion list then it should return all the allowances for each employee on highlighted cells in column F.

Please see the attachment.

Your help would be really apprecaited.

Although your question is slightly related, it is different from the original. You should probably put it in a new post. (When you do that you could post a link to that post in this thread to give it some continuity).

Some clarification please?
If there is any number of exclusions do you want a list of the remaining allowance?. And if none, do you want all? Is that correct?

Does you data look like the image?
If so, that complicates things (for me, others forum members may know how to work it out.
Are only Allowance Types and Employee Numbers in Column F?

Can you change the format of the resulting output? (horizontal instead of vertical.)

How do you get this data? Can your source get it to you differently?
 
Upvote 0
Try:
Book1
ABCDEFGHIJ
1
2
3EmployeeAllowances
411068246Allowance 1Employee NoEmployeeAllowances
511068246Allowance 21106824611068246Allowance 4
611068246Allowance 310903301Allowance 8
711068246Allowance 4Allowance 1
810903301Allowance 1Allowance 2
910903301Allowance 2Allowance 3
1010903301Allowance 3
1110903301Allowance 4Employee No
1210903301Allowance 510903301
1310903301Allowance 6
1410903301Allowance 7Allowance 1
1510903301Allowance 8Allowance 2
16Allowance 3
17Allowance 4
18Allowance 5
19Allowance 6
20Allowance 7
Sheet2
Cell Formulas
RangeFormula
F7:F9,F14:F20F7=FILTER($C$4:$C$15,($B$4:$B$15=F5)*($C$4:$C$15<>FILTER($J$5:$J$6,$I$5:$I$6=F5)))
Dynamic array formulas.
 
Upvote 0
Try:
Book1
ABCDEFGHIJ
1
2
3EmployeeAllowances
411068246Allowance 1Employee NoEmployeeAllowances
511068246Allowance 21106824611068246Allowance 4
611068246Allowance 310903301Allowance 8
711068246Allowance 4Allowance 1
810903301Allowance 1Allowance 2
910903301Allowance 2Allowance 3
1010903301Allowance 3
1110903301Allowance 4Employee No
1210903301Allowance 510903301
1310903301Allowance 6
1410903301Allowance 7Allowance 1
1510903301Allowance 8Allowance 2
16Allowance 3
17Allowance 4
18Allowance 5
19Allowance 6
20Allowance 7
Sheet2
Cell Formulas
RangeFormula
F7:F9,F14:F20F7=FILTER($C$4:$C$15,($B$4:$B$15=F5)*($C$4:$C$15<>FILTER($J$5:$J$6,$I$5:$I$6=F5)))
Dynamic array formulas.
Thanks for your reply.

The formula is working but see below.

The only bit left is, if that can be built in this formula is. Currently, I have to put something in I and J columns (Exclusion List), otherwise the formula will not work. What I want is, if I don't want exclude anything for an employee, then the formula should show all the allowances in column F, without putting any thing in I and J columns (Exclusion List).
 
Upvote 0
Minor change to the formula.
Book1
ABCDEFGHIJ
1
2
3EmployeeAllowances
411068246Allowance 1Employee NoEmployeeAllowances
511068246Allowance 21106824611068246Allowance 4
611068246Allowance 3
711068246Allowance 4Allowance 1
810903301Allowance 1Allowance 2
910903301Allowance 2Allowance 3
1010903301Allowance 3
1110903301Allowance 4Employee No
1210903301Allowance 510903301
1310903301Allowance 6
1410903301Allowance 7Allowance 1
1510903301Allowance 8Allowance 2
16Allowance 3
17Allowance 4
18Allowance 5
19Allowance 6
20Allowance 7
21Allowance 8
Sheet2
Cell Formulas
RangeFormula
F7:F9,F14:F21F7=FILTER($C$4:$C$15,($B$4:$B$15=F5)*($C$4:$C$15<>FILTER($J$5:$J$6,$I$5:$I$6=F5,TRUE)))
Dynamic array formulas.
 
Upvote 0
Minor change to the formula.
Book1
ABCDEFGHIJ
1
2
3EmployeeAllowances
411068246Allowance 1Employee NoEmployeeAllowances
511068246Allowance 21106824611068246Allowance 4
611068246Allowance 3
711068246Allowance 4Allowance 1
810903301Allowance 1Allowance 2
910903301Allowance 2Allowance 3
1010903301Allowance 3
1110903301Allowance 4Employee No
1210903301Allowance 510903301
1310903301Allowance 6
1410903301Allowance 7Allowance 1
1510903301Allowance 8Allowance 2
16Allowance 3
17Allowance 4
18Allowance 5
19Allowance 6
20Allowance 7
21Allowance 8
Sheet2
Cell Formulas
RangeFormula
F7:F9,F14:F21F7=FILTER($C$4:$C$15,($B$4:$B$15=F5)*($C$4:$C$15<>FILTER($J$5:$J$6,$I$5:$I$6=F5,TRUE)))
Dynamic array formulas.
Another Limitation jut found now in the formula is, if I have to exclude multiple Allowances for a particular Employee, then it gives error.

Can this be fixed please!
 
Upvote 0

Forum statistics

Threads
1,224,813
Messages
6,181,118
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