Filter columns with criteria

GMC The Macro Man

Board Regular
Joined
Mar 23, 2023
Messages
64
Office Version
  1. 2021
Platform
  1. Windows
Hello there
The spreadsheet below shows a list of pupils with some of the subjects they are going to sit this year.
The values under the subjects, represent the expected result they will achieve. The scale is 1 = Excellent and 8 = Very Poor.
I needed to filter out (on a separate sheet) any pupil who has a 7 or 8 listed in their expected results.
Thanks to FLUFF (Mr Excel MVP) he was able to assist me using the formula below which worked perfectly.
=LET(f,FILTER(Grading!A2:N11,MMULT(--(Grading!D2:N11>=7),SEQUENCE(COLUMNS(Grading!D1:N1),,,0))),IF(f="","",f))

The client has now asked if they could add another column after each subject with a Grading value of either 4,5,6 or 7.
On the 2nd image you can see I have added the extra columns (Shaded) but because this could also contain a "7" in the column, it follows the above formula and brings over data in that row.
Using Fluffs formula, I tried to pick just the columns that i required but i am failing big time
I need the formula that FLUFF gave me but only to filter on these columns, D15,F15,H15,J15,L15,N15,P15,R15,T15,V15, W15,X15,Y15

Can anyone help?
TIA
George

Grading.xlsx
ABCDEFGHIJKLMN
1NameClassGenderArt & Design Business Chemistry Dance Design Drama English French Geography Graphics History
2George4AMale426782
3Larry4AMale33333
4Divya4AFemale11187
5Urvesh4AMale54772
6Suzie4BFemale78583
7Beth4BFemale33333
8Tom4BMale35222
9Simone4CFemale22728
10Colin4CMale53553
11Stephanie4CFemale66666
Grading



Grading.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXY
14NameClassGenderArt & Design A&D GradeBusiness Bus GradeChemistry Chem GradeDance Dance GradeDesign Des GradeDrama Drama GradeEnglish Eng GradeFrench French GradeGeography Geo GradeGraphics Graph GradeHistory Hist Grade
15George4AMale45266745872
16Larry4AMale4335436363
17Divya4AFemale571611845774
18Urvesh4AMale7545747726
19Suzie4BFemale7865845377
20Beth4BFemale6363434337
21Tom4BMale35627244247
22Simone4CFemale226757286
23Colin4CMale653655345576
24Stephanie4CFemale666667
Grading
 

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.
How about
Excel Formula:
=LET(d,CHOOSECOLS(Grading!D2:Y11,SEQUENCE(,11,,2)),f,FILTER(HSTACK(Grading!A2:C11,d),MMULT(--(d>=7),SEQUENCE(COLUMNS(d),,,0))),IF(f="","",f))
 
Upvote 1
Thank you Fluff.
I'm using Office Pro Plus 2021 and it seems it does not like CHOOSECOLS or HSTACK in my formulation (I'm sure I have used CHOOSECOLS before).
I'm getting the error #NAME? and when I step through it it highlights these 2.
Is there another way to do this calculation or to force this one through.
TIA
George
 
Upvote 0
Oops, how about
Excel Formula:
=LET(r,SEQUENCE(ROWS(Grading!D2:Y11)),d,INDEX(Grading!D2:Y11,r,SEQUENCE(,11,,2)),c,COLUMNS(d),s,SEQUENCE(,c+3),f,FILTER(IF(s<=3,Grading!A2:C11,INDEX(d,r,s-3)),MMULT(--(d>=7),SEQUENCE(c,,,0))),IF(f=0,"",f))
 
Upvote 0
Oops, how about
Excel Formula:
=LET(r,SEQUENCE(ROWS(Grading!D2:Y11)),d,INDEX(Grading!D2:Y11,r,SEQUENCE(,11,,2)),c,COLUMNS(d),s,SEQUENCE(,c+3),f,FILTER(IF(s<=3,Grading!A2:C11,INDEX(d,r,s-3)),MMULT(--(d>=7),SEQUENCE(c,,,0))),IF(f=0,"",f))
Hi Fluff

I tried to make your Formula above work in my spreadsheet but I couldn't get it to work properly, but this is not your fault. Its mine because in the sample spreadsheet above, I only gave a minimal selection of data (for GDPR reasons) so when I tried to implement this in to the larger working sheet, even though I thought it would just be a simple change to the formula, I couldn't get it to work so if you would be so kind, could you have a look at the data sheet that I am working on.
There are 27 subjects from Accounting to Tourism. Each subject has 4 columns, Nat Level, Teacher, Tracking Grade and Working Grade.

My request is to look at the Working grade column for every subject and if it holds a 7 or above then to FILTER that row in to a different sheet. Other columns may have a number 7 or above so its crucial to just focus the filter on the Working Grade columns.
The size of this sheet is from cell A2-DH600 (the xL2BB only allows a limited number of cells to copy over)

Is there any way you can help
Thanks as always


School Grading.xlsx
ABCDEFGHIJKLMNOPQRSTUVW
1Unique IDFull NameReg ClassAccounting Nat LevelAccounting TeacherAcc Tracking GradeAcc Working GradeArt & Design Nat LevelArt & Design TeacherA&D Tracking GradeA&D Working GradeAutomotive Engineering Nat LevelAutomative TeacherAuto Tracking GradeAuto Working GradeBiology Nat LevelBiology TeacherBiology Tracking GradeBiology Working GradeBusiness Nat LevelBusiness TeacherBusiness Tracking GradeBus Working Grade
2141266535Aaron Anthony Dempsey4ANat 4Scott Singer66Nat 5Marie Claire McCallum66
3141264788Aaron Lucas4A
4141265792Abby Kelly4ANat 4Scott Singer66Nat 5Abby Murray77
5141254774Aiden Thom4ANat 5Joseph Brannan44
6141380699Anthony Hamilton4ANat 5Marie Claire McCallum77
7141254456Cailin Marie Gilliland4ANat 5Ruth Mercedes Ramsay13Nat 5Scott Singer23
8141265865Caitlin Ann Tierney4ANat 5Ciara Barclay00Nat 5Scott Singer67Nat 5Abby Murray44
9141266837Callum Donaldson4AScott Singer69Nat 5Marie Claire McCallum77
10141283138Callum Quinn4ANat 4Scott Singer67Nat 5
11141254375George Brown4ANat 5Amanda Lynas35
12140904546Harvey Forbes4ANat 5Amanda Lynas69Nat 5Marie Claire McCallum77
13181420634Hope Eniayeye Joseph4ANat 5Hannah Coakley78
14141282840Joe Carrigan4A
15141355821Jorgia Cassidy4ANat 4Scott Singer66Nat 5Ciara Barclay00
16141265482Joshua Gallagher4ANat 5Abby Murray11
17141254677Kayla Elizabeth Paterson4ANat 4Scott Singer67Nat 5Ciara Barclay00
18141274430Keira Louise McCann4A
19141254588Kieran McFarlane4ANat 5Anne Sulko78
20141265652Kitty Marcella Mary Murphy O'Neill4ANat 4Anne Sulko66
21141265490Lewis John King4ANat 4Anne Sulko66
22141576348Lucy Nolan4ANat 5Scott Singer56Nat 5Joseph Brannan22
23141254669Matthew O'Connor4ANat 5Abby Murray44
24141254685Paige Purdue4ANat 5Ciara Barclay00Nat 5Scott Singer67Nat 5Joseph Brannan44
25141363263Patrick Joseph Curtis4ANat 4Scott Singer66
26141254502Rhys Jackson4ANat 5Abby Murray55
27141266608Ruaridh Gilchrist4ANat 5Marie Claire McCallum55
28141264567Zak Charlie Chapman4ANat 4 Scott Singer67
29141254626Zoe Anna Maguire4ANat 5Hannah Coakley56Nat 5Abby Murray11
30141266756Adam Mason4B
31141254448Aimee Gillies4BNat 5Anne Sulko23
32141282778Bobby David McDonald4BNat 4Anne Sulko66
33141446266Cole Quinn4BNat 5Scott Singer68
34141254413Corry Fagan4BNat 4Scott Singer66
35141282921Eamonn Peter Quinn4BNat 5Marie Claire McCallum33
36141267655Elizabeth Morrison4BNat 5Amanda Lynas35
37141254510Ellie Mairead Jones4BNat 5Anne Sulko67
38141254707Emily Marie Reilly4BNat 5Georgia Galloway66Nat 5Scott Singer68
39141254812Finn O'Brien4B
40141266500Fraser Crockett4B
Sheet1
 
Upvote 0
Try
Excel Formula:
=LET(r,SEQUENCE(ROWS(Grading!D2:DH600)),d,INDEX(Grading!D2:DH600,r,SEQUENCE(,27,4,4)),c,COLUMNS(d),s,SEQUENCE(,c+3),f,FILTER(IF(s<=3,Grading!A2:C600,INDEX(d,r,s-3)),MMULT(--(d>=7),SEQUENCE(c,,,0))),IF(f=0,"",f))
 
Upvote 0
Try
Excel Formula:
=LET(r,SEQUENCE(ROWS(Grading!D2:DH600)),d,INDEX(Grading!D2:DH600,r,SEQUENCE(,27,4,4)),c,COLUMNS(d),s,SEQUENCE(,c+3),f,FILTER(IF(s<=3,Grading!A2:C600,INDEX(d,r,s-3)),MMULT(--(d>=7),SEQUENCE(c,,,0))),IF(f=0,"",f))
Thanks Fluff
I.m just heading for the train and I will get this checked tonight.
Appreciate as always
 
Upvote 0
H Fluff

I ran this and it does filter out the data if it contains a 7 or above in any of the "Working Grade" columns so that's great but it actually squeezies all the data into the first 5 or 6 columns so from column AD, there is nothing. See the Mini Sheet.

Would it be possible to change it slightly so that it pulls over all the data in the row if it contains a 7or above in any of the working grades, so not to return just the Working Grade only but it would have the Nat Level, Teachers Name, Tracking Grade and Working Grade. As the image below
Cheers



1698270273482.png



School Grading.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJAKALAMAN
1Unique IDFull NameReg ClassAccounting Nat LevelAccounting TeacherAcc Tracking GradeAcc Working GradeArt & Design Nat LevelArt & Design TeacherA&D Tracking GradeA&D Working GradeAutomotive Engineering Nat LevelAutomative TeacherAuto Tracking GradeAuto Working GradeBiology Nat LevelBiology TeacherBiology Tracking GradeBiology Working GradeBusiness Nat LevelBusiness TeacherBusiness Tracking GradeBus Working GradeChemistry Nat LevelChemistry TeacherChemistry Tracking GradeChemistry Working GradeDesign Nat LevelDesign TeacherDesign Tracking GradeDesign Working GradeDrama Nat LevelDrama TeacherDrama Tracking GradeDrama Working GradeEnglish Nat LevelEnglish TeacherEnglish Tracking GradeEnglish Working GradeFrench Nat Level
2141266535Aaron Anthony Dempsey4A6666776
3141264788Aaron Lucas4A7676757
4141265792Abby Kelly4A6767868
5141254774Aiden Thom4A4867755
6141380699Anthony Hamilton4A798887
7141265865Caitlin Ann Tierney4A746475
8141266837Callum Donaldson4A976658
9141283138Callum Quinn4A7979999
10141254375George Brown4A5786867
11140904546Harvey Forbes4A9767767
12181420634Hope Eniayeye Joseph4A8777786
13141282840Joe Carrigan4A7979
14141355821Jorgia Cassidy4A65687
15141254677Kayla Elizabeth Paterson4A7877
16141274430Keira Louise McCann4A9
17141254588Kieran McFarlane4A8866366
18141265652Kitty Marcella Mary Murphy O'Neill4A6686788
19141265490Lewis John King4A6778779
20141576348Lucy Nolan4A6257445
21141254669Matthew O'Connor4A4647454
22141254685Paige Purdue4A744745
23141254502Rhys Jackson4A5667467
24141266608Ruaridh Gilchrist4A5857752
25141264567Zak Charlie Chapman4A7777668
26141254626Zoe Anna Maguire4A6167676
27141266756Adam Mason4B4345547
28141282778Bobby David McDonald4B6676786
29141446266Cole Quinn4B855665
Sheet2
Cell Formulas
RangeFormula
A2:AD180A2=LET(r,SEQUENCE(ROWS(Grading!D2:DH600)),d,INDEX(Grading!D2:DH600,r,SEQUENCE(,27,4,4)),c,COLUMNS(d),s,SEQUENCE(,c+3),f,FILTER(IF(s<=3,Grading!A2:C600,INDEX(d,r,s-3)),MMULT(--(d>=7),SEQUENCE(c,,,0))),IF(f=0,"",f))
Dynamic array formulas.
 
Upvote 0
## Update on the above ##
"squeezies all the data into the first 5 or 6 columns so from column AD, there is nothing."
Having looked at this in more detail i can see thats because I have still kept ALL the column headers in my output page and NOT filtered out JUST the Working Grade columns, so your formula is PERFECT in my eyes....
I will present this to my client tomorrow and explain this is a cleaner output but I know what they are like and I;m positive the will ask for everything to be returned.
So see my question above about pulling over all the data - would this be possible please?
 
Upvote 0

Forum statistics

Threads
1,215,076
Messages
6,122,983
Members
449,092
Latest member
Mr Hughes

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