Home » excel » excel – How to filter rows where a column A cell value is not part of a pattern of values from other rows?

excel – How to filter rows where a column A cell value is not part of a pattern of values from other rows?

Posted by: admin May 14, 2020 Leave a comment

Questions:

I need to filter a column that contains a pattern of the numbers 1-5 in individual cells in the column. If the 1-5 pattern is broken, I need to hide the offending cells. Is there a built in feature or do I need to make a VBA macro?

Example

How to&Answers:

Please don’t mind the Dutch equivalent to TRUE and FALSE (WAAR & ONWAAR), but you could use:

=CONCAT(INDEX(A:A,ROW()-(A2-1)):INDEX(A:A,ROW()+(5-A2)))="12345"

enter image description here

I used headers, to prevent error on row parsing in the formula. And you might want to use IFERROR to prevent errors when your first value is a 5 for example.

Answer:

Another way:

=(A1>=1)*(A1<=5)*PRODUCT(--(INDEX(A:A,N(IF({1},{1,2,3,4,5}-A1+ROW())))={1,2,3,4,5}))

enter image description here