Solved

Query table in excel, filter by date

Posted on 2014-01-18
7
1,111 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
7 Comments
 
LVL 29

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 31

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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

A2 = A1 That kind of cell reference is relative.  If you copy it from A2 to B2, then B2 will get this: B2 = B1 That's all fine and good, but if you then insert a new row above row 2, you'll find: A3 = A1 B3 = B1 This is intentional. …
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
Viewers will learn the basics of slicers and timelines for both PivotTables and standard Excel tables in Excel 2013.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

757 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now