How to group filtered data

Clayton18

New Member
Joined
Dec 11, 2023
Messages
7
Office Version
  1. 365
Platform
  1. Windows
Hi!

I'm looking for some help in grouping sets of data for when a filter is applied.

Example below:

Says below is the original set of data - I would like to be able to filter by tests that have "failed". Is it possible to keep all of Test number 2 & 4 showing when I filter for "fail"
1708659870043.png


Below is an example what I would like it to look like when the filter is applied.
1708659966944.png


Any help would be great!

Thanks,
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
You could add a work column that shows "Fail" if any step in the test fails, then filter on that. For example:

Book1
ABCDE
1Test NumberStepInstructionsPass/FailTest Result
211Open SoftwarePass 
32Wait 5 minutesPass 
43Close SoftwarePass 
521Open SoftwarePassFail
62Click "New"PassFail
73Wait 5 minutesFailFail
84Close SoftwarePassFail
931Open SoftwarePass 
102Close SoftwarePass 
1141Open SoftwarePassFail
122Click "New"PassFail
133type 5 wordsPassFail
144Wait 5 minutesFailFail
155Close SoftwarePassFail
Sheet5
Cell Formulas
RangeFormula
E2:E15E2=LET(rng,INDEX(D$2:D2,XMATCH("Open Software",C$2:C2,0,-1)):INDEX(D2:D20,MATCH("Close Software",C2:C20,0)),c,COUNTIF(rng,"Fail"),IF(c,"Fail",""))
Cells with Conditional Formatting
CellConditionCell FormatStop If True
D:D,E1Cell Value="Fail"textNO
D:D,E1Cell Value="Pass"textNO


The hardest part of this was the merged cells with the test number. I had to look for the start and end of the test, and I just resorted to looking for "Open Software" and "Close Software" which bracketed each test. If that's not always going to be the case, I can look for a 1 in the step for the starting cell in the range, and look for a 1 (or empty cell) at the end, and back up 1 row.

If you put the test number in each of the rows, then it's much easier:

Book1
ABCDE
1Test NumberStepInstructionsPass/FailTest Result
211Open SoftwarePass 
32Wait 5 minutesPass 
43Close SoftwarePass 
521Open SoftwarePassFail
62Click "New"PassFail
73Wait 5 minutesFailFail
84Close SoftwarePassFail
931Open SoftwarePass 
102Close SoftwarePass 
1141Open SoftwarePassFail
122Click "New"PassFail
133type 5 wordsPassFail
144Wait 5 minutesFailFail
155Close SoftwarePassFail
Sheet6
Cell Formulas
RangeFormula
E2:E15E2=IF(COUNTIFS(A:A,A2,D:D,"Fail"),"Fail","")
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:A15Expression=A1=A2textNO
D1:D15,E1Cell Value="Fail"textNO
D1:D15,E1Cell Value="Pass"textNO


I used Conditional Formatting to hide the test number after the first row.
 
Upvote 0
If you want to keep the merged cells in column A then another option would be to use two helper columns (E & F for me and E could be hidden) to keep the formulas simpler & not dependant on any particular values in col C.

24 02 23.xlsm
ABCDEF
1Test NumberStepInstructionsPass/FailTNTest Result
211Open SoftwarePass1 
32Wait 5 minutesPass1 
43Close SoftwarePass1 
521Open SoftwarePass2Fail
62Click "New"Pass2Fail
73Wait 5 minutesFail2Fail
84Close SoftwarePass2Fail
931Open SoftwarePass3 
102Close SoftwarePass3 
1141Open SoftwarePass4Fail
122Click "New"Pass4Fail
133type 5 wordsPass4Fail
144Wait 5 minutesFail4Fail
155Close SoftwarePass4Fail
Fail
Cell Formulas
RangeFormula
E2:E15E2=LOOKUP(9^9,A$2:A2)
F2:F15F2=IF(COUNTIFS(E$2:E$15,E2,D$2:D$15,"Fail"),"Fail","")
 
Upvote 0
You could add a work column that shows "Fail" if any step in the test fails, then filter on that. For example:

Book1
ABCDE
1Test NumberStepInstructionsPass/FailTest Result
211Open SoftwarePass 
32Wait 5 minutesPass 
43Close SoftwarePass 
521Open SoftwarePassFail
62Click "New"PassFail
73Wait 5 minutesFailFail
84Close SoftwarePassFail
931Open SoftwarePass 
102Close SoftwarePass 
1141Open SoftwarePassFail
122Click "New"PassFail
133type 5 wordsPassFail
144Wait 5 minutesFailFail
155Close SoftwarePassFail
Sheet5
Cell Formulas
RangeFormula
E2:E15E2=LET(rng,INDEX(D$2:D2,XMATCH("Open Software",C$2:C2,0,-1)):INDEX(D2:D20,MATCH("Close Software",C2:C20,0)),c,COUNTIF(rng,"Fail"),IF(c,"Fail",""))
Cells with Conditional Formatting
CellConditionCell FormatStop If True
D:D,E1Cell Value="Fail"textNO
D:D,E1Cell Value="Pass"textNO


The hardest part of this was the merged cells with the test number. I had to look for the start and end of the test, and I just resorted to looking for "Open Software" and "Close Software" which bracketed each test. If that's not always going to be the case, I can look for a 1 in the step for the starting cell in the range, and look for a 1 (or empty cell) at the end, and back up 1 row.

If you put the test number in each of the rows, then it's much easier:

Book1
ABCDE
1Test NumberStepInstructionsPass/FailTest Result
211Open SoftwarePass 
32Wait 5 minutesPass 
43Close SoftwarePass 
521Open SoftwarePassFail
62Click "New"PassFail
73Wait 5 minutesFailFail
84Close SoftwarePassFail
931Open SoftwarePass 
102Close SoftwarePass 
1141Open SoftwarePassFail
122Click "New"PassFail
133type 5 wordsPassFail
144Wait 5 minutesFailFail
155Close SoftwarePassFail
Sheet6
Cell Formulas
RangeFormula
E2:E15E2=IF(COUNTIFS(A:A,A2,D:D,"Fail"),"Fail","")
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:A15Expression=A1=A2textNO
D1:D15,E1Cell Value="Fail"textNO
D1:D15,E1Cell Value="Pass"textNO


I used Conditional Formatting to hide the test number after the first row.
Hi, this looks awesome!

Could it be possible for the formula to look 1 in the step column and end 1 row above the next 1? if so what would the formula look like?
The "instructions" in this scenario were purely simple examples, generally they start and finish with different. wording

Cheers!
cell) at the end, an
 
Upvote 0
Here's how it would look using the Step to find the start/stop of the ranges:

Book1
ABCDE
1Test NumberStepInstructionsPass/FailTest Result
211Open SoftwarePass 
32Wait 5 minutesPass 
43Close SoftwarePass 
521Open SoftwarePassFail
62Click "New"PassFail
73Wait 5 minutesFailFail
84Close SoftwarePassFail
931Open SoftwarePass 
102Close SoftwarePass 
1141Open SoftwarePassFail
122Click "New"PassFail
133type 5 wordsPassFail
144Wait 5 minutesFailFail
155Close SoftwarePassFail
16 
Sheet5
Cell Formulas
RangeFormula
E2:E16E2=LET(rng,INDEX(D:D,XLOOKUP(1,B$2:B2,ROW(B$2:B2),,0,-1)):INDEX(D:D,XLOOKUP(1,B3:B20,ROW(B3:B20),ROW(B20),0)-1),c,COUNTIF(rng,"Fail"),IF(AND(c,B2<>""),"Fail",""))
Cells with Conditional Formatting
CellConditionCell FormatStop If True
D:D,E1Cell Value="Fail"textNO
D:D,E1Cell Value="Pass"textNO


This formula assumes that no test will have over 20 steps. If that might happen, just change the 20 in the formula (2 places) to a higher value.
 
Upvote 0
Hi, this looks awesome!
Seems like you were not interested in the 2-column approach. In that case, would this work for you?
Where I have used 30 in the formula (twice) use any number that will definitely be greater than the number of rows of data that you will ever have.

24 02 23.xlsm
ABCDE
1Test NumberStepInstructionsPass/FailTest Result
211Open SoftwarePass 
32Wait 5 minutesPass 
43Close SoftwarePass 
521Open SoftwarePassFail
62Click "New"PassFail
73Wait 5 minutesFailFail
84Close SoftwarePassFail
931Open SoftwarePass 
102Close SoftwarePass 
1141Open SoftwarePassFail
122Click "New"PassFail
133type 5 wordsPassFail
144Wait 5 minutesFailFail
155Close SoftwarePassFail
16
17
Fail (2)
Cell Formulas
RangeFormula
E2:E15E2=IF(B2=1,IF(IFNA(MATCH("Fail",D2:D$30,0),9^9)<=IFNA(MATCH(1,B3:B$30,0),9^8),"Fail",""),E1)
 
Upvote 0
Solution
Seems like you were not interested in the 2-column approach. In that case, would this work for you?
Where I have used 30 in the formula (twice) use any number that will definitely be greater than the number of rows of data that you will ever have.

24 02 23.xlsm
ABCDE
1Test NumberStepInstructionsPass/FailTest Result
211Open SoftwarePass 
32Wait 5 minutesPass 
43Close SoftwarePass 
521Open SoftwarePassFail
62Click "New"PassFail
73Wait 5 minutesFailFail
84Close SoftwarePassFail
931Open SoftwarePass 
102Close SoftwarePass 
1141Open SoftwarePassFail
122Click "New"PassFail
133type 5 wordsPassFail
144Wait 5 minutesFailFail
155Close SoftwarePassFail
16
17
Fail (2)
Cell Formulas
RangeFormula
E2:E15E2=IF(B2=1,IF(IFNA(MATCH("Fail",D2:D$30,0),9^9)<=IFNA(MATCH(1,B3:B$30,0),9^8),"Fail",""),E1)
Hi Peter,

This is perfect. Thank you!
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

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