Filter by specific data with multiple conditionss

ExcelLearner0612

New Member
Joined
Mar 2, 2017
Messages
4
I am using Excel 2010. I have a CSV file which I opened in Excel. It has a lot of data in it. I have to exclude specific data from it. For example: I have a bunch of zip codes, and I need to exclude the ones that end in 3, 5, or 7. I have tried the advanced filtering option to no avail. I have to display the zip codes that do NOT end with 3, 5, or 7. Please advise how would I go about this. I have watched numerous YouTube videos, but none seemed to apply to what I need. I have wasted 2 days trying to figure this out. I'm running out of time. Thank you in advance.
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
I would stick with Advanced Filter.

In my test I have the Zip codes in column D and I'm using Z1:Z2 as my Advanced Filter Criteria range

Z1: Leave blank
Z2: =ISNA(MATCH(RIGHT(D2,1)+0,{3,5,7},0))


Edit: BTW, welcome to the MrExcel board!
 
Last edited:
Upvote 0
I would stick with Advanced Filter.

In my test I have the Zip codes in column D and I'm using Z1:Z2 as my Advanced Filter Criteria range

Z1: Leave blank
Z2: =ISNA(MATCH(RIGHT(D2,1)+0,{3,5,7},0))


Edit: BTW, welcome to the MrExcel board!

Thanks for your help. When I try this, it says reference is not valid. What is Z1 and Z2 stand for? The zip codes that end with either 3 or 5 or 7 need to be excluded.
 
Upvote 0
What is Z1 and Z2 stand for?
Z1 and Z2 are cells on the worksheet - the top 2 cells in column Z.
You said that you had tried Advanced Filter so I assumed you knew what was meant by a Criteria Range since that is one of the input boxes in the Adv Filter dialog.

You said you had a sheet with "a lot of data". That is vague to me who cannot see your sheet, so I have no idea how many columns or rows that involves. Therefore I made up a small set of dummy data as shown below, just using columns A:F with random numbers in column D to represent Zip codes.

In column Z (it could be any available column) I left the top cell (Z1) blank.
In cell Z2 I put the formula that I posted above, and shown again below.


Excel 2010 32 bit
ABCDEFYZ
1Hdr 1Hdr 2Hdr 3ZipHdr 5Hdr 6
2datadatadata2973datadataFALSE
3datadatadata9225datadata
4datadatadata299datadata
5datadatadata94datadata
6datadatadata4098datadata
7datadatadata3392datadata
8datadatadata1679datadata
9datadatadata2690datadata
10datadatadata2157datadata
11datadatadata8113datadata
12datadatadata2575datadata
13datadatadata4046datadata
14datadatadata3543datadata
15datadatadata9774datadata
16datadatadata2991datadata
17datadatadata5208datadata
18datadatadata5608datadata
19datadatadata9845datadata
20datadatadata7360datadata
Exclude Zip Codes
Cell Formulas
RangeFormula
Z2=ISNA(MATCH(RIGHT(D2,1)+0,{3,5,7},0))


I selected the data, A1:F20, went to the 'Data' ribbon tab and chose 'Advanced' in the Sort & Filter section.
In the dialog that opened I put the following information
Filter the list, in place
List Range: A1:F20
Criteria range: Z1:Z2
I clicked 'OK'

This is the result. Note the hidden row numbers at the left. Is it what you would want for that sample data?


Excel 2010 32 bit
ABCDEF
1Hdr 1Hdr 2Hdr 3ZipHdr 5Hdr 6
4datadatadata299datadata
5datadatadata94datadata
6datadatadata4098datadata
7datadatadata3392datadata
8datadatadata1679datadata
9datadatadata2690datadata
13datadatadata4046datadata
15datadatadata9774datadata
16datadatadata2991datadata
17datadatadata5208datadata
18datadatadata5608datadata
20datadatadata7360datadata
Exclude Zip Codes
 
Upvote 0
Thank you for your reply. Wow! This is so complicated. Yes, I saw the Criteria Range, but it was very confusing. So by selecting the entire worksheet in the List Range Field, then typing the formula in the cell of a blank column, and then choosing that as Criteria Range, will filter all the zip codes by excluding zip codes that end in 3, 5, 7? Will this filter apply to other columns in the worksheet since I have data in those columns that end with 3, or 5, or 7? My columns are form A through AJ.
 
Upvote 0
So by selecting the entire worksheet in the List Range Field, ..
You would not select the entire worksheet for the List Range field, only where your data is A1:AJ??




... then typing the formula in the cell of a blank column, and then choosing that as Criteria Range, will filter all the zip codes by excluding zip codes that end in 3, 5, 7?
Clearly you cannot use column Z as your data goes beyond that. You would have to use column AK or something to the right of that.

My formula was =ISNA(MATCH(RIGHT(D2,1)+0,{3,5,7},0)) since my zip codes were in column D. You need to change that to whatever column your zip codes are in. That formula will only hide '3', '5' & '7' zip codes in that one column that the formula refers to.

If you have multiple columns with zip codes then you will need to give more details about which columns they are and how you would determine which rows to hide.
For example, if row 10 has a '3' zip code in column H but a '4' zip code in column AB, do you want that row hidden since it will hide a non-3,5,7 zip code as well as the '3' zip code because you can't hide part of a row.
 
Upvote 0

Forum statistics

Threads
1,216,099
Messages
6,128,820
Members
449,469
Latest member
Kingwi11y

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