Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

filter data based on more than 1 criteria

Status
Not open for further replies.

newprogamer

Programmer
Sep 22, 2004
107
US
Hi Everyone,

I would like to filter a column based on more than 1 citeria. When the criteria is meant I would like the filtered data to be copied to a new spreadsheet.

For example: If I wanted to filter the data where the age is 20 and 30, then copy these rows to a new spreadsheet.

A B C
Name Age Favorite Color
1 Tracy 30 Red
2 Tonya 20 Blue
3 Dana 30 Red
4 Tiffney 19 Blue
5 Belinda 25 Pink

Please help!
New Programmer
 
Try this:

SELECT Name, Age, FavoriteColor INTO newTable
FROM yourTable
WHERE Age = 20 OR Age = 30;

This will create a new table with just the people whose age is 20 or 30.
 
Hi lynch or anyone available,

Is this code to add to the workbook of the VB editor? Excel doesn't recognize the word SELECT.

Thanks,
 
Have a look at AdvancedFilter in the Excel VBA help.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top