Solved

Query table in excel, filter by date

Posted on 2014-01-18
7
1,334 Views
Last Modified: 2014-01-21
I have a table of projects in Excel.  There is a column for Project Name and and column for End Date.  I would like a query in a separate worksheet that returns a column of data containing only those Project Names that end prior to a date I enter into a cell in Excel.  Suggestions for best way?

So far:
Pivot Table - does not have filter for less than arbitrary date.

Control Array - returns only filtered projects but leaves blank lines where projects do not match criteria.  I do not want blank lines.

VBA code - yes, I could build my own filter easily enough, but prefer existing tools if possible.  This may end up as best solution.

query builder - not friendly to finding tables in existing workbook.  I would like to be proven wrong about this.
0
Comment
Question by:RolandGarton
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 30

Expert Comment

by:gowflow
ID: 39790927
I could help in VBA if and when you feel ready have a file posted first.
gowflow
0
 
LVL 16

Accepted Solution

by:
Jerry Paladino earned 175 total points
ID: 39792097
If your data is in a List / Table format then MS-Query is a simple solution.   In Excel 2007-2013 - Data menu, Get External Data, From Other Sources, "From Microsoft Query".   This uses ODBC to make a connection to the Excel files.   In the Choose Data Source dialog, select Excel Files*.   Select the workbook in the next dialog and then select the Worksheet in the "Add Tables" dialog.   There is an "Options..." button on the Add Tables dialog.  Make sure "System Tables" is checked or the available worksheets in the workbook will not display.

Use the ADD button to select one or more worksheets.   From there you have the ability to join tables and write SQL.   The user interface provides some drag and drop but don't expect MS-Access like capabilities.  

Screen shots below and the attached PDF show the steps to build a query and add the Parameter for selecting the date to show your projects.   The PDF is for a query to MS-Access but the steps are the same and the document is more detailed than the screenshots below.

HTH
Jerry
Project ListChoose data sourceSelect WorkbookAdd TablesQuery GridProperties dialogPropertiesParametersResult SetParameter-Query-with-Excel.pdf
0
 
LVL 33

Assisted Solution

by:Rob Henson
Rob Henson earned 25 total points
ID: 39796888
Have you looked at the Advanced Filter function?

This can extract data for specific columns that match specific criteria. This can be on a separate worksheet in the same workbook or can filter the data in place.

Thanks
Rob H
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Closing Comment

by:RolandGarton
ID: 39797235
Jerry - very helpful, thanks much.  I appreciate the examples.  I'm glad to know about the parametric option for queries--will be useful in other applications.  Problem, though: Once I created a new query, I then wanted to edit the query.  When I right-click/Table/Edit query I get the "connecting to data source..." box I'm used to, but this box does not eventually yield to Microsoft Query.  Instead, it hangs Excel and I have to use Task Manager to exit.  Do you know how I can edit the query after I've set it up?

Rob H - Thanks for the pointer.  Advanced Filter with copy elsewhere is an option I didn't know about.  It's a one-time deal that doesn't automatically update, so not as robust as Jerry's solution.
0
 
LVL 16

Expert Comment

by:Jerry Paladino
ID: 39798850
Roland,

Go to "Connection Properties" dialog box, which is the screen shot third from the bottom that I posted above.   To the left of the Parameters button is the Edit Query button.   That will take you back to the MS-Query screens.  Once you are comfortable with the SQL syntax you can edit the SQL that you see in the "Command Text" box on that same dialog if you want to.   Or, continue to use the drag and drop capabilities within MS-Query.

Use the "Refresh" dropdown on the Data Ribbon to get to the Connection Properties dialog box as shown below:Connection Properties
0
 

Author Comment

by:RolandGarton
ID: 39798965
Same problem.  I get the Connecting to data source dialog, and Excel hangs, to be stopped only through the Task Manager.

Connecting message
0
 
LVL 16

Expert Comment

by:Jerry Paladino
ID: 39798992
Roland,

Not sure since it works fine on both of my laptops.  May I suggest that you use two separate files as a place to start troubleshooting.   Have your complete list of projects in one workbook and setup the Query in second workbook.   That may avoid the connection issues you are experiencing.
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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 demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

728 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