Formula for counting most recent consecutive failures based on multiple criteria.

singha23

New Member
Joined
Nov 28, 2016
Messages
7
Hello,

I am trying to create a formula that will count the most recent consecutive appearances of "Fail" in the table below based on a number of criteria. I have been researching and come across a proposal for using a max/frequency array formula which I adapted for this dataset and pasted in below. The problem is that I want it to only count the most recent occurences of consecutive failure based on the date entered. For example the formula I am using returns a count of 5 consecutive failures before 1/11/2016. I want the result of this formula to display as 1 consecutive failure because there are "Pass" values that proceed the November row. If I was to set the date value in the formula to "1/12/2016" the formula should display 2 consecutive failures because both November and December's values are a 'Fail' but the failures earlier in the year should be disregarded. I am hoping to develop a catch-all formula that can be carried across the entire history of my data which will continue to be appended to each month and will only count the most recent set of consecutive failures for the given criteria.

I have a sample workbook I can provide with the data and formula if that would be helpful.

**enter as array formula (ctrl+shift+enter)

=MAX(FREQUENCY(IF(A5:A16<="1/11/2016",IF(B5:B16="apple",IF(C5:C16="banana",IF(D5:D16="Fail",ROW(D5:D16))))),IF(A5:A16>="1/11/2016",IF(B5:B16<>"apple",IF(C5:C16<>"banana",IF(D5:D16<>"Fail",ROW(D5:D16)))))))

1/01/2016applebananaFail
1/02/2016applebananaFail
1/03/2016applebananaFail
1/04/2016applebananaPass
1/05/2016applebananaPass
1/06/2016applebananaPass
1/07/2016applebananaPass
1/08/2016applebananaPass
1/09/2016applebananaPass
1/10/2016applebananaPass
1/11/2016applebananaFail
1/12/2016applebananaFail

<colgroup><col><col><col><col></colgroup><tbody>
</tbody>
 
Hi again,

in E5 array entered


Code:
=ROWS($1:5)-IFERROR(LARGE(IF(A$5:$A$16<=A5,IF($D$5:$D$16="Pass",ROW($5:$16))),1),4)


or if you're using Excel 2010

Code:
=ROWS($1:5)-IFERROR(AGGREGATE(14,6,ROW($5:$16)/(($A$5:$A$16<=A5)*($D$5:$D$16="Pass")),1),4)


Regards
 
Last edited:
Upvote 0

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Thanks Canapone! This appears to give exactly the desired results for the sample data set :)

I need to spend some time looking into how the formula you wrote is working but there is one last thing that I need to be able to do. That is to add the two criteria for the "apple" and "banana" columns to the formula so that I could change some of those values to say "pear" and "orange" and have it count those failures separately in the same manner as the apple and banana values.
 
Upvote 0

Forum statistics

Threads
1,214,919
Messages
6,122,260
Members
449,075
Latest member
staticfluids

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