Advanced Filter (does not end with)

ThePan2002

New Member
Joined
Nov 4, 2005
Messages
5
Hello. I was trying to filter some data with the "Does not end with" logic in the autofilter...but I need 3 conditions instead of two. So, I created an advanced filter using the does not contain logic.

I have a list of Cities..with "City" being the heading. Each city has a hyphen and a couple of letters describing the county. Here are some examples: Shelbyville-S, Pana-CH, Neoga-CU.

Elsewhere I have three adjacent cells labeled "City" for my filtering. I have the conditions on different rows (so it's treated as an OR).

I have: ="<>*-S*" ; ="<>*-CH*" ; ="<>*-M*"

They work fine individually, but not together. I was wondering if someone knew how to use the "Does not end with" logic...I think that it'd be a lot easier to say that it doesn't end in "-M" or "-S".

Thanks.
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
ThePan2002 said:
Hello. I was trying to filter some data with the "Does not end with" logic in the autofilter...but I need 3 conditions instead of two. So, I created an advanced filter using the does not contain logic.

I have a list of Cities..with "City" being the heading. Each city has a hyphen and a couple of letters describing the county. Here are some examples: Shelbyville-S, Pana-CH, Neoga-CU.

Elsewhere I have three adjacent cells labeled "City" for my filtering. I have the conditions on different rows (so it's treated as an OR).

I have: ="<>*-S*" ; ="<>*-CH*" ; ="<>*-M*"

They work fine individually, but not together. I was wondering if someone knew how to use the "Does not end with" logic...I think that it'd be a lot easier to say that it doesn't end in "-M" or "-S".

Thanks.

Should the result list include Istanbul-MP, given your criteria?
 
Upvote 0
Well...as of right now...I'm dealing with a small enough list that I don't have anything except for -M...but you are right...I only want -M...so it really should be does not end with.

You know how to do it?
 
Upvote 0
Not quite sure how you sort it, but it is the logic that is at fault.- the OR condition

You have asked for does not end with -s OR -CH OR -M.


Well they all don't end with at least two of them so all records are false

The filter is working but has nothing to filter as all records don't meet the criteria.
 
Upvote 0
Thank you GorD. You were completely correct about the logic. I've made that mistake on this filter before...I don't know why I think it should be OR.

And, you were right too, Aladin...the filter would include cells that I don't want.

Maybe anyone else can help with the "does not end with" part?

Thanks for all your help thus far.
 
Upvote 0
ThePan2002 said:
...
And, you were right too, Aladin...the filter would include cells that I don't want.

Maybe anyone else can help with the "does not end with" part?

...

My question was and still is: Given...

City
Shelbyville-S
Pana-CH
Neoga-CU
Istanbul-MP

what is the expected result list?
 
Upvote 0
Aladin Akyurek said:
ThePan2002 said:
...
And, you were right too, Aladin...the filter would include cells that I don't want.

Maybe anyone else can help with the "does not end with" part?

...

My question was and still is: Given...

City
Shelbyville-S
Pana-CH
Neoga-CU
Istanbul-MP

what is the expected result list?


Neoga-CU and Istanbul-MP would be left.



If the list included:
Findlay-M
Pana-CH
Neoga-CU
Istanbul-MP
Shelbyville-S

Then the result would be Istanbul-MP and Neoga-CU.
 
Upvote 0
ThePan2002 said:
Aladin Akyurek said:
ThePan2002 said:
...
And, you were right too, Aladin...the filter would include cells that I don't want.

Maybe anyone else can help with the "does not end with" part?

...

My question was and still is: Given...

City
Shelbyville-S
Pana-CH
Neoga-CU
Istanbul-MP

what is the expected result list?


Neoga-CU and Istanbul-MP would be left.



If the list included:
Findlay-M
Pana-CH
Neoga-CU
Istanbul-MP
Shelbyville-S

Then the result would be Istanbul-MP and Neoga-CU.
aaAdvFilter thepan2002.xls
ABCD
1City-S
2Shelbyville-S-CHFALSE
3Pana-CH-MCity
4Neoga-CUNeoga-CU
5Istanbul-MPIstanbul-MP
6
Sheet1


C1:C3 houses the Ends-With values of interest

Criteria range is D1:D2.

D1 must be left empty.

D2 houses:

=ISNA(MATCH(REPLACE(A2,1,SEARCH("-",A2)-1,"")&"*",$C$1:$C$3,0))
 
Upvote 0
Thank you. I really appreciate your help.

Is there an easy way to add another condition to the filter? I want to filter by City (as you have done), and also filter out any "Agents" named REMAX. I had planned on just adding it to the filter, but I didn't realize that it would be a formula.

Also, if I want to filter a list in a different Sheet, do I just put Sheet1! in front of the values?
 
Upvote 0
ThePan2002 said:
Thank you. I really appreciate your help.

Is there an easy way to add another condition to the filter? I want to filter by City (as you have done), and also filter out any "Agents" named REMAX. I had planned on just adding it to the filter, but I didn't realize that it would be a formula.

Also, if I want to filter a list in a different Sheet, do I just put Sheet1! in front of the values?

Sheet1 (Source)
aaAdvFilterExtended thepan2002.xls
ABCD
1CityAgent
2Shelbyville-SBRIAN
3Pana-CHJON
4Neoga-CUREMAX
5Istanbul-MPDAMON
6
Sheet1


Sheet2 (Destination)
aaAdvFilterExtended thepan2002.xls
ABCDEF
1-SAgentCityAgent
2-CHFALSEREMAXNeoga-CUREMAX
3-M
4REMAX
5
6
7
Sheet2


A1:A4 is used to record the criteria of interest.

B1:C2 is the criteria range with:

B1 left empty;

B2:

=ISNA(MATCH(REPLACE(Sheet1!A2,1,SEARCH("-",Sheet1!A2)-1,"")&"*",$A$1:$A$3,0))

C1: Agent

C2:

=A4

Make sure that you follow the recipe below:

1. Select B1:C2.

2. Activate Data|Filter|Advanced Filter.

3. Check the option "Copy to another location".

4. Set List range to: Sheet1!$A$1:$B$5

5. Set Criteria range to: $B$1:$C$2

6. Set Copy to to: $E$1

7. Leave the option "Unique records only" unchecked.

8. Click OK.
 
Upvote 0

Forum statistics

Threads
1,214,515
Messages
6,119,974
Members
448,934
Latest member
audette89

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