PC Review


Reply
Thread Tools Rate Thread

Create macro to filter on multiple criteria

 
 
=?Utf-8?B?Y3NkamowMjExOTE=?=
Guest
Posts: n/a
 
      20th Sep 2006
I have 6 columns in my worksheet which are grouped into 3 pairs of columns.
Columns A, C and E are the current data for a given product and Columns B, D,
and F are the previous data. For instance, Column A result for cell 1 is
"January" and Column B result for cell 1 is "March". Similarly for the other
two sets of columns.

What I want to be able to do is filter to just those rows were the current
data is different from the previous data. Therefore, I need to filter on
Columns A, C, and E to just those rows where Column A is different than
Column B, or Column C is different than Column D, or Column E is different
than Column F.

I can do this individually for Columns A/B, or C/D, or E/F using advanced
filter but want to be able to 1) create a macro to do it, and 2) be able to
do it using all 3 sets of columns as the criteria.

Thanks!
 
Reply With Quote
 
 
 
 
=?Utf-8?B?QmlsbCBQZmlzdGVy?=
Guest
Posts: n/a
 
      20th Sep 2006
One approach is to have separate columns that represent where the conditions
are met. For example, you could have column H be True if A=C, I be True if
B=D, J be True if C=E, K true is H=I=J=True. Then you can filter on any of
these conditional columns.

Not sure of your macro-writing ability, but you could also implement the
same functionality in code.

Regards,
Bill


"csdjj021191" wrote:

> I have 6 columns in my worksheet which are grouped into 3 pairs of columns.
> Columns A, C and E are the current data for a given product and Columns B, D,
> and F are the previous data. For instance, Column A result for cell 1 is
> "January" and Column B result for cell 1 is "March". Similarly for the other
> two sets of columns.
>
> What I want to be able to do is filter to just those rows were the current
> data is different from the previous data. Therefore, I need to filter on
> Columns A, C, and E to just those rows where Column A is different than
> Column B, or Column C is different than Column D, or Column E is different
> than Column F.
>
> I can do this individually for Columns A/B, or C/D, or E/F using advanced
> filter but want to be able to 1) create a macro to do it, and 2) be able to
> do it using all 3 sets of columns as the criteria.
>
> Thanks!

 
Reply With Quote
 
=?Utf-8?B?Y3NkamowMjExOTE=?=
Guest
Posts: n/a
 
      21st Sep 2006


"Bill Pfister" wrote:

> One approach is to have separate columns that represent where the conditions
> are met. For example, you could have column H be True if A=C, I be True if
> B=D, J be True if C=E, K true is H=I=J=True. Then you can filter on any of
> these conditional columns.
>
> Not sure of your macro-writing ability, but you could also implement the
> same functionality in code.
>
> Regards,
> Bill
>
>
> "csdjj021191" wrote:
>
> > I have 6 columns in my worksheet which are grouped into 3 pairs of columns.
> > Columns A, C and E are the current data for a given product and Columns B, D,
> > and F are the previous data. For instance, Column A result for cell 1 is
> > "January" and Column B result for cell 1 is "March". Similarly for the other
> > two sets of columns.
> >
> > What I want to be able to do is filter to just those rows were the current
> > data is different from the previous data. Therefore, I need to filter on
> > Columns A, C, and E to just those rows where Column A is different than
> > Column B, or Column C is different than Column D, or Column E is different
> > than Column F.
> >
> > I can do this individually for Columns A/B, or C/D, or E/F using advanced
> > filter but want to be able to 1) create a macro to do it, and 2) be able to
> > do it using all 3 sets of columns as the criteria.
> >
> > Thanks!

 
Reply With Quote
 
=?Utf-8?B?Y3NkamowMjExOTE=?=
Guest
Posts: n/a
 
      21st Sep 2006
Thanks, Bill. I'd like to be able to handle this without adding all of the
separate columns. Is there any way to do all of it via a basic macro without
having to create extra columns within the worksheet?

"Bill Pfister" wrote:

> One approach is to have separate columns that represent where the conditions
> are met. For example, you could have column H be True if A=C, I be True if
> B=D, J be True if C=E, K true is H=I=J=True. Then you can filter on any of
> these conditional columns.
>
> Not sure of your macro-writing ability, but you could also implement the
> same functionality in code.
>
> Regards,
> Bill
>
>
> "csdjj021191" wrote:
>
> > I have 6 columns in my worksheet which are grouped into 3 pairs of columns.
> > Columns A, C and E are the current data for a given product and Columns B, D,
> > and F are the previous data. For instance, Column A result for cell 1 is
> > "January" and Column B result for cell 1 is "March". Similarly for the other
> > two sets of columns.
> >
> > What I want to be able to do is filter to just those rows were the current
> > data is different from the previous data. Therefore, I need to filter on
> > Columns A, C, and E to just those rows where Column A is different than
> > Column B, or Column C is different than Column D, or Column E is different
> > than Column F.
> >
> > I can do this individually for Columns A/B, or C/D, or E/F using advanced
> > filter but want to be able to 1) create a macro to do it, and 2) be able to
> > do it using all 3 sets of columns as the criteria.
> >
> > Thanks!

 
Reply With Quote
 
=?Utf-8?B?QmlsbCBQZmlzdGVy?=
Guest
Posts: n/a
 
      21st Sep 2006
Yes, you can have the macro compare the values of the columns of interest and
then hide rows when they don't meet your filter criteria.


"csdjj021191" wrote:

> Thanks, Bill. I'd like to be able to handle this without adding all of the
> separate columns. Is there any way to do all of it via a basic macro without
> having to create extra columns within the worksheet?
>
> "Bill Pfister" wrote:
>
> > One approach is to have separate columns that represent where the conditions
> > are met. For example, you could have column H be True if A=C, I be True if
> > B=D, J be True if C=E, K true is H=I=J=True. Then you can filter on any of
> > these conditional columns.
> >
> > Not sure of your macro-writing ability, but you could also implement the
> > same functionality in code.
> >
> > Regards,
> > Bill
> >
> >
> > "csdjj021191" wrote:
> >
> > > I have 6 columns in my worksheet which are grouped into 3 pairs of columns.
> > > Columns A, C and E are the current data for a given product and Columns B, D,
> > > and F are the previous data. For instance, Column A result for cell 1 is
> > > "January" and Column B result for cell 1 is "March". Similarly for the other
> > > two sets of columns.
> > >
> > > What I want to be able to do is filter to just those rows were the current
> > > data is different from the previous data. Therefore, I need to filter on
> > > Columns A, C, and E to just those rows where Column A is different than
> > > Column B, or Column C is different than Column D, or Column E is different
> > > than Column F.
> > >
> > > I can do this individually for Columns A/B, or C/D, or E/F using advanced
> > > filter but want to be able to 1) create a macro to do it, and 2) be able to
> > > do it using all 3 sets of columns as the criteria.
> > >
> > > Thanks!

 
Reply With Quote
 
=?Utf-8?B?Y3NkamowMjExOTE=?=
Guest
Posts: n/a
 
      21st Sep 2006
Unfortunately, I don't know how to write the macro so that it uses more than
one criteria range when I want it to use 3 different criteria ranges. Any
ideas?

"Bill Pfister" wrote:

> Yes, you can have the macro compare the values of the columns of interest and
> then hide rows when they don't meet your filter criteria.
>
>
> "csdjj021191" wrote:
>
> > Thanks, Bill. I'd like to be able to handle this without adding all of the
> > separate columns. Is there any way to do all of it via a basic macro without
> > having to create extra columns within the worksheet?
> >
> > "Bill Pfister" wrote:
> >
> > > One approach is to have separate columns that represent where the conditions
> > > are met. For example, you could have column H be True if A=C, I be True if
> > > B=D, J be True if C=E, K true is H=I=J=True. Then you can filter on any of
> > > these conditional columns.
> > >
> > > Not sure of your macro-writing ability, but you could also implement the
> > > same functionality in code.
> > >
> > > Regards,
> > > Bill
> > >
> > >
> > > "csdjj021191" wrote:
> > >
> > > > I have 6 columns in my worksheet which are grouped into 3 pairs of columns.
> > > > Columns A, C and E are the current data for a given product and Columns B, D,
> > > > and F are the previous data. For instance, Column A result for cell 1 is
> > > > "January" and Column B result for cell 1 is "March". Similarly for the other
> > > > two sets of columns.
> > > >
> > > > What I want to be able to do is filter to just those rows were the current
> > > > data is different from the previous data. Therefore, I need to filter on
> > > > Columns A, C, and E to just those rows where Column A is different than
> > > > Column B, or Column C is different than Column D, or Column E is different
> > > > than Column F.
> > > >
> > > > I can do this individually for Columns A/B, or C/D, or E/F using advanced
> > > > filter but want to be able to 1) create a macro to do it, and 2) be able to
> > > > do it using all 3 sets of columns as the criteria.
> > > >
> > > > Thanks!

 
Reply With Quote
 
=?Utf-8?B?QmlsbCBQZmlzdGVy?=
Guest
Posts: n/a
 
      21st Sep 2006
You won't be using the native Excel filtering capability; you will need to
write it from scratch. Here's an example:

http://wcpii.com/Documents/MacroFilter.xls


"csdjj021191" wrote:

> Unfortunately, I don't know how to write the macro so that it uses more than
> one criteria range when I want it to use 3 different criteria ranges. Any
> ideas?
>
> "Bill Pfister" wrote:
>
> > Yes, you can have the macro compare the values of the columns of interest and
> > then hide rows when they don't meet your filter criteria.
> >
> >
> > "csdjj021191" wrote:
> >
> > > Thanks, Bill. I'd like to be able to handle this without adding all of the
> > > separate columns. Is there any way to do all of it via a basic macro without
> > > having to create extra columns within the worksheet?
> > >
> > > "Bill Pfister" wrote:
> > >
> > > > One approach is to have separate columns that represent where the conditions
> > > > are met. For example, you could have column H be True if A=C, I be True if
> > > > B=D, J be True if C=E, K true is H=I=J=True. Then you can filter on any of
> > > > these conditional columns.
> > > >
> > > > Not sure of your macro-writing ability, but you could also implement the
> > > > same functionality in code.
> > > >
> > > > Regards,
> > > > Bill
> > > >
> > > >
> > > > "csdjj021191" wrote:
> > > >
> > > > > I have 6 columns in my worksheet which are grouped into 3 pairs of columns.
> > > > > Columns A, C and E are the current data for a given product and Columns B, D,
> > > > > and F are the previous data. For instance, Column A result for cell 1 is
> > > > > "January" and Column B result for cell 1 is "March". Similarly for the other
> > > > > two sets of columns.
> > > > >
> > > > > What I want to be able to do is filter to just those rows were the current
> > > > > data is different from the previous data. Therefore, I need to filter on
> > > > > Columns A, C, and E to just those rows where Column A is different than
> > > > > Column B, or Column C is different than Column D, or Column E is different
> > > > > than Column F.
> > > > >
> > > > > I can do this individually for Columns A/B, or C/D, or E/F using advanced
> > > > > filter but want to be able to 1) create a macro to do it, and 2) be able to
> > > > > do it using all 3 sets of columns as the criteria.
> > > > >
> > > > > Thanks!

 
Reply With Quote
 
=?Utf-8?B?Y3NkamowMjExOTE=?=
Guest
Posts: n/a
 
      3rd Oct 2006
Thanks, Bill. Sorry I didn't reply earlier but I was out of the office last
week. I'm pretty much a novice at macros so it will take me a while to
figure out exactly what you've done but it looks great!

"Bill Pfister" wrote:

> You won't be using the native Excel filtering capability; you will need to
> write it from scratch. Here's an example:
>
> http://wcpii.com/Documents/MacroFilter.xls
>
>
> "csdjj021191" wrote:
>
> > Unfortunately, I don't know how to write the macro so that it uses more than
> > one criteria range when I want it to use 3 different criteria ranges. Any
> > ideas?
> >
> > "Bill Pfister" wrote:
> >
> > > Yes, you can have the macro compare the values of the columns of interest and
> > > then hide rows when they don't meet your filter criteria.
> > >
> > >
> > > "csdjj021191" wrote:
> > >
> > > > Thanks, Bill. I'd like to be able to handle this without adding all of the
> > > > separate columns. Is there any way to do all of it via a basic macro without
> > > > having to create extra columns within the worksheet?
> > > >
> > > > "Bill Pfister" wrote:
> > > >
> > > > > One approach is to have separate columns that represent where the conditions
> > > > > are met. For example, you could have column H be True if A=C, I be True if
> > > > > B=D, J be True if C=E, K true is H=I=J=True. Then you can filter on any of
> > > > > these conditional columns.
> > > > >
> > > > > Not sure of your macro-writing ability, but you could also implement the
> > > > > same functionality in code.
> > > > >
> > > > > Regards,
> > > > > Bill
> > > > >
> > > > >
> > > > > "csdjj021191" wrote:
> > > > >
> > > > > > I have 6 columns in my worksheet which are grouped into 3 pairs of columns.
> > > > > > Columns A, C and E are the current data for a given product and Columns B, D,
> > > > > > and F are the previous data. For instance, Column A result for cell 1 is
> > > > > > "January" and Column B result for cell 1 is "March". Similarly for the other
> > > > > > two sets of columns.
> > > > > >
> > > > > > What I want to be able to do is filter to just those rows were the current
> > > > > > data is different from the previous data. Therefore, I need to filter on
> > > > > > Columns A, C, and E to just those rows where Column A is different than
> > > > > > Column B, or Column C is different than Column D, or Column E is different
> > > > > > than Column F.
> > > > > >
> > > > > > I can do this individually for Columns A/B, or C/D, or E/F using advanced
> > > > > > filter but want to be able to 1) create a macro to do it, and 2) be able to
> > > > > > do it using all 3 sets of columns as the criteria.
> > > > > >
> > > > > > Thanks!

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do you create a Macro to return text from multiple cells that fit your criteria? bdolney@gmail.com Microsoft Excel Programming 1 25th May 2007 08:35 AM
Create Filter from on multiple criteria =?Utf-8?B?TU1NIE90dGF3YQ==?= Microsoft Access Form Coding 1 12th Oct 2006 05:38 PM
Need macro to filter, create tab on filter and copy/paste Jen Microsoft Excel Programming 1 2nd May 2006 04:45 PM
Need macro to filter, create tab on filter and copy/paste Jen Microsoft Excel Programming 1 2nd May 2006 04:45 PM
advanced filter macro to locate values via multiple criteria jjfjr Microsoft Excel Programming 1 8th Nov 2005 03:28 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:29 AM.