Solved

Excel VBA Query

Posted on 2013-06-04
14
198 Views
Last Modified: 2014-05-23
I have an excel spreadsheet with data that i am look to execute a query to filter it. I want to filter the data in "Measures List" tab by executing a query on the "Input" tab. The issue is I don't know how to query on multiple variables for each criteria.

So for example, I want to be able to select High & Medium in the Impact Potential column and also a number of time frames in the "Total Time" column & also be able to search for a wildcard in the Focus Area & Responsibility columns.

Can anyone help me on this?
0
Comment
Question by:j8547
  • 6
  • 5
14 Comments
 
LVL 23

Expert Comment

by:Michael74
ID: 39221712
Without an example sheet it is hard to be specific but this may help

http://office.microsoft.com/en-au/excel-help/filter-by-using-advanced-criteria-HP005200178.aspx

Michael
0
 

Author Comment

by:j8547
ID: 39222118
Sorry forgot to attach the sheet. I have now.

All help is appreciated. I am looking for the VBA code for the query.
test.xlsx
0
 
LVL 45

Expert Comment

by:aikimark
ID: 39222161
You should populate a criteria range with your filtering data and the apply an advancedfilter to the data.  See the attached workbook for an example.

Also, I've done an EE podcast on advanced filtering, which is viewable on the EE YouTube channel, which you might want to watch.
http://www.youtube.com/watch?v=0M4gePK8510
test.xlsx
0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 

Author Comment

by:j8547
ID: 39222218
do you know how i can fit a wildcard in?
0
 
LVL 45

Expert Comment

by:aikimark
ID: 39222233
look at my criteria range on the first worksheet.  I used a wildcard.
0
 

Author Comment

by:j8547
ID: 39222253
the execute query didn't work so wasn't sure what was working
0
 

Author Comment

by:j8547
ID: 39222259
Sorry for tall the questions just can't find how you did it. how then can I add filter 2, 3, 4 and so on.

Thanks for the help
0
 
LVL 45

Expert Comment

by:aikimark
ID: 39222271
I manually applied the AdvancedFilter.  Advanced Filter is one of your filtering options.

The video shows the VBA statements that can be used to apply an advanced filter.
0
 

Author Comment

by:j8547
ID: 39222663
is there a way i can see the manual advanced filter you applied?
0
 
LVL 45

Expert Comment

by:aikimark
ID: 39222687
Do you see the criteria range I created on the first sheet?
0
 

Author Comment

by:j8547
ID: 39223107
yes
0
 
LVL 45

Accepted Solution

by:
aikimark earned 500 total points
ID: 39223413
I provided the data range and the criteria range to the AdvancedFilter dialog.  You can change the criteria cells (there are three rows, including the column name row) and reapply the Advanced Filter.
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question