FILTER top n based on cell value

nburaq

Board Regular
Joined
Apr 2, 2021
Messages
222
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hi Gents,
I would like to filter my results based on the cell value (it will be week number) entered in A1 at Sheet1. Sheet2 includes the data to be filtered. I know how to filter top 5 data but I could not find where to set range for filtering. Thanks in advance for the comments and help!

Sample:Filter top nth value (lets say for top 5)
=FILTER(UDT!A:H;UDT!F:F>=LARGE(UDT!F:F;5))

Sheet1:

A1: 5 (Week Number)

Sheet2:

DayLocationProblemHoursWeek No
12/03/2022​
Floor1Electrical
8​
10​
09/03/2022​
Floor1Electrical
6​
10​
09/03/2022​
Floor1Electrical
4​
8​
09/03/2022​
Floor3Mechanical
3​
10​
09/03/2022​
Floor3Mechanical
2​
6​
08/03/2022​
Floor3Mechanical
2​
10​
08/03/2022​
Floor4Mechanical
1​
10​
07/03/2022​
Floor4Electrical
2​
10​
07/03/2022​
Floor4Electrical
4​
10​
07/03/2022​
Floor2Electrical
3​
10​
12/03/2022​
Floor2Electrical
3​
10​
09/03/2022​
Floor2Electrical
2​
11​
09/03/2022​
Floor1Electrical
2​
12​
09/03/2022​
Floor1Mechanical
1​
11​
09/03/2022​
Floor3Mechanical
2​
13​
08/03/2022​
Floor3Mechanical
7​
12​
08/03/2022​
Floor3Mechanical
6​
12​
07/03/2022​
Floor3Electrical
4​
12​
07/03/2022​
Floor2Electrical
3​
13​
07/03/2022​
Floor2Mechanical
2​
13​
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Just replace the 5 with A1, unless I misunderstood the question.
 
Upvote 0
If you provide an XL2BB of your data, we woule be able to give a more precise answer but see if this is what you are after.
I have assumed you want the
  • The large of hrs which I have as column E
  • The filter on Week with the number being in A1 and the week column being F

Excel Formula:
=FILTER($A$5:$F$24,(LARGE(($F$5:$F$24=$A$1)*$E$5:$E$24,5)<=$E$5:$E$24)*($F$5:$F$24=$A$1),"No Data")

For a walk through see:
(6 mins)
 
Upvote 0
Solution
Just replace the 5 with A1, unless I misunderstood the question.
Hi Rory,
formula will filter the values based on week number entered in sheet1 A1 with top 5 results of hours
If you provide an XL2BB of your data, we woule be able to give a more precise answer but see if this is what you are after.
I have assumed you want the
  • The large of hrs which I have as column E
  • The filter on Week with the number being in A1 and the week column being F

Excel Formula:
=FILTER($A$5:$F$24,(LARGE(($F$5:$F$24=$A$1)*$E$5:$E$24,5)<=$E$5:$E$24)*($F$5:$F$24=$A$1),"No Data")

For a walk through see:
(6 mins)
Thanks a lot! This was exactly what I was looking for!
 
Upvote 0

Forum statistics

Threads
1,215,731
Messages
6,126,538
Members
449,316
Latest member
sravya

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