ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   special filter or query (https://www.excelbanter.com/excel-programming/422003-special-filter-query.html)

tiktin

special filter or query
 
I need a filter which will show all rows n and n+1, if and only if, in row n,
A=1 and B=1, and in row n+1, A=0, B=2 and C=4; or, in row n, A=0, B=1 and
C=4, and in row n+1, A=1 and B=2. In other words, whether or not a row is to
be displayed depends not only on what is in the row but also on what is in
the preceding row or the following row. Can you tell me how to do this?
Thanks.

ND Pard

special filter or query
 
For my suggestion to work, your first row of data can NOT start in row 1.
However, row 1 CAN contain your column headers.

Assuming row 1 DOES contain column headers and row 2 is your 1st row of data:

In the first available column to the right of your data, in row 1 add the
column header "Test Column".

In row 2, immediately below the cell containing "Test Column", enter the
following formula:

=IF(OR(OR(AND(A2=1,B2=1,A3=0,B3=2,C3=4),AND(A2=0,B 2=2,C2=4,A1=1,B1=1)),OR(AND(A2=0,B2=1,C2=4,A3=1,B3 =2),AND(A2=1,B2=2,A1=0,B1=1,C1=4))),"Condition
Met","Condition Not Met")

Copy the formula down to your last row of data.

Now you should be able to apply a filter on your Test Column for all rows
that contain "Condition Met".

Good Luck


Ie, if your data DOES start in row 1, insert a row so row 1 is blank.


"tiktin" wrote:

I need a filter which will show all rows n and n+1, if and only if, in row n,
A=1 and B=1, and in row n+1, A=0, B=2 and C=4; or, in row n, A=0, B=1 and
C=4, and in row n+1, A=1 and B=2. In other words, whether or not a row is to
be displayed depends not only on what is in the row but also on what is in
the preceding row or the following row. Can you tell me how to do this?
Thanks.



All times are GMT +1. The time now is 06:03 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com