If Statment for filters?


Posted by paul Magruder on June 20, 2001 4:10 AM

Is there code that will allow me to search for a number in 3 columns, then filter the data accorningly?

What I need is...if 1234 is found in in columns C, D, or E, then show those rows.....

Thanks
Paul



Posted by Mark W. on June 20, 2001 8:41 AM

Create a criteria and use it along with an
Advanced AutoFilter. Suppose C1:E5 contains...

{"Field1","Field2","Field3"
;1234,1234,"XXXX"
;"XXXX",1234,"XXXX"
;"XXXX","XXXX","XXXX"
;"XXXX","XXXX",1234}

...and that you've specified the following criteria
in cells G1:I4...

{"Field1","Field2","Field3"
;1234,,
;,1234,
;,,1234}

An Advanced AutoFilter using this criteria range
will display all rows except 4:4.

For more on criteria see the Excel Help topic for
"Examples of advanced filter criteria".