dynamic, dynamic data validation list - amazon web...

15
Dynamic, Dynamic Data Validation List By Mynda Treacy – www.MyOnlineTrainingHub.com John Tang, one of our dashboard members was tackling the homework project asked me if I knew a way you could generate a dynamic list of unique names from this column of sales people. It’s a great question since it’s quite likely that there will be new salespeople added to this list as the data grows. The only non-VBA ways John and I could think of were: Formulas – but they weren’t ideal as they were very complicated and cumbersome. PivotTables – but also not ideal as multiple PivotTables would take up unnecessary storage. Advanced Filter – but this would have to be manually re- created each time new data was added. So, at a dead end I contacted a friend and Extreme Excel Expert, Roberto Mensa in Italy, who came up with the idea of using Microsoft Query to reference an Excel table and extract a unique list from the Sales Person column. I call this ‘Excel Looky Likey Access’, because when you use Microsoft Query it works very similarly to Access. Excel 2010 Process 1. Format your Excel data in a Table (Insert tab of the ribbon > Table) and save the workbook . 2. Set up your query: a. Select a cell outside of the table. b. Data > From Other Sources > From Microsoft Query

Upload: hakhuong

Post on 07-May-2018

222 views

Category:

Documents


6 download

TRANSCRIPT

Page 1: dynamic, Dynamic Data Validation List - Amazon Web …trainingworkingfiles.s3.amazonaws.com/dashboards/Dynamic... · Web viewDynamic, Dynamic Data Validation List By Mynda Treacy

Dynamic, Dynamic Data Validation ListBy Mynda Treacy – www.MyOnlineTrainingHub.com

John Tang, one of our dashboard members was tackling the homework project asked me if I knew a way you could generate a dynamic list of unique names from this column of sales people. It’s a great question since it’s quite likely that there will be new salespeople added to this list as the data grows.

The only non-VBA ways John and I could think of were:

Formulas – but they weren’t ideal as they were very complicated and cumbersome. PivotTables – but also not ideal as multiple PivotTables would take up unnecessary storage. Advanced Filter – but this would have to be manually re-created each time new data was

added.

So, at a dead end I contacted a friend and Extreme Excel Expert, Roberto Mensa in Italy, who came up with the idea of using Microsoft Query to reference an Excel table and extract a unique list from the Sales Person column.

I call this ‘Excel Looky Likey Access’, because when you use Microsoft Query it works very similarly to Access.

Excel 2010 Process1. Format your Excel data in a Table (Insert tab of the ribbon > Table) and save the workbook. 2. Set up your query:

a. Select a cell outside of the table.b. Data > From Other Sources > From Microsoft Queryc. <New Data Source>

Page 2: dynamic, Dynamic Data Validation List - Amazon Web …trainingworkingfiles.s3.amazonaws.com/dashboards/Dynamic... · Web viewDynamic, Dynamic Data Validation List By Mynda Treacy

d. In field 1 give your query a name. In field 2 select ‘Microsoft Excel Driver [*.xls, *.xlsx, *.xlsm, *.xlsb]’ from the driver list

e. Click ‘Connect‘.f. Choose Excel 12.0 from the Version

g. Click ‘Select Workbook’ then browse to your workbook and select it as your Database Name:

Page 3: dynamic, Dynamic Data Validation List - Amazon Web …trainingworkingfiles.s3.amazonaws.com/dashboards/Dynamic... · Web viewDynamic, Dynamic Data Validation List By Mynda Treacy

h. In field 4 select a your ‘Sheet Name$’ from the list. My sheet name is ‘Sales Data’

i. Click Okj. Then at the Choose Data Source window click OK. Note: your new data source name

should be selected:

Page 4: dynamic, Dynamic Data Validation List - Amazon Web …trainingworkingfiles.s3.amazonaws.com/dashboards/Dynamic... · Web viewDynamic, Dynamic Data Validation List By Mynda Treacy

k. This will open the Microsoft Query window.

Page 5: dynamic, Dynamic Data Validation List - Amazon Web …trainingworkingfiles.s3.amazonaws.com/dashboards/Dynamic... · Web viewDynamic, Dynamic Data Validation List By Mynda Treacy

l. Drag the column name from the database down to the query section below.

Page 6: dynamic, Dynamic Data Validation List - Amazon Web …trainingworkingfiles.s3.amazonaws.com/dashboards/Dynamic... · Web viewDynamic, Dynamic Data Validation List By Mynda Treacy

m. Click on the SQL icon and edit the SQL arguments to include ‘DISTICNT’ after ‘SELECT’:

i. Your SQL statement should read: SELECT DISTINCT ‘your sheet name$’.`the name of the field in your table`FROM ‘your sheet name$’ ‘your sheet name$’Note: your sheet name is repeated twice on the FROM line.

Page 7: dynamic, Dynamic Data Validation List - Amazon Web …trainingworkingfiles.s3.amazonaws.com/dashboards/Dynamic... · Web viewDynamic, Dynamic Data Validation List By Mynda Treacy

n. Click OK and you should see the results of your query, which is a list of unique (DISTINCT) names from the Sales Person column of your Excel table.

o. Press the open door icon to take the data back to the Excel worksheetp. Select where you want it displayed:

q. Click ok. You should now see a list of your unique names from the Sales Person column.

Page 8: dynamic, Dynamic Data Validation List - Amazon Web …trainingworkingfiles.s3.amazonaws.com/dashboards/Dynamic... · Web viewDynamic, Dynamic Data Validation List By Mynda Treacy

r. Now when you add new data to the bottom of your Excel Table you simply need to save the workbook then refresh the connection to update your unique list of names.

3. Now you will have two tables in your Excel workbook; one is the Table you set up in step 1, and the other is the table generated by the Microsoft Query.

4. Give your unique list of names as a named range. I’ll call mine Unique_Names.5. Set up your Data Validation list and use the named range of your unique list of names as the

Source:

Page 9: dynamic, Dynamic Data Validation List - Amazon Web …trainingworkingfiles.s3.amazonaws.com/dashboards/Dynamic... · Web viewDynamic, Dynamic Data Validation List By Mynda Treacy

Excel 2007 Process1. Format your Excel data in a Table (Insert tab of the ribbon > Table) and save the workbook. 2. Set up your query:

a. Select a cell outside of the table.b. Data > From Other Sources > From Microsoft Queryc. <New Data Source>

Page 10: dynamic, Dynamic Data Validation List - Amazon Web …trainingworkingfiles.s3.amazonaws.com/dashboards/Dynamic... · Web viewDynamic, Dynamic Data Validation List By Mynda Treacy

d. In field 1 give your query a name. In field 2 select ‘Microsoft Excel Driver [*.xls, *.xlsx, *.xlsm, *.xlsb]’ from the driver list

e. Click ‘Connect‘.f. Choose Excel 12.0 from the Version

g. Click ‘Select Workbook’ then browse to your workbook and select it as your Database Name:

Page 11: dynamic, Dynamic Data Validation List - Amazon Web …trainingworkingfiles.s3.amazonaws.com/dashboards/Dynamic... · Web viewDynamic, Dynamic Data Validation List By Mynda Treacy

h. Leave Field 4 Blank and click OKi. Then at the Choose Data Source window click OK. Note: your new data source name

should be selected:

j. At the Query Wizard you can either select the whole worksheet or expand the list and select just the ‘Sales Person’ column.

Page 12: dynamic, Dynamic Data Validation List - Amazon Web …trainingworkingfiles.s3.amazonaws.com/dashboards/Dynamic... · Web viewDynamic, Dynamic Data Validation List By Mynda Treacy

k. Click Next, Next and Next. Then at the ‘Query Wizard – Finish’ select ‘View data or edit query in Microsoft Query’ and click Finish:

l. This will open the Microsoft Query window. m. Click on the SQL icon and edit the SQL arguments to include ‘DISTICNT’ after

‘SELECT’:

i. Your SQL statement should read: SELECT DISTINCT ‘your sheet name$’.`the name of the field in your table`

Page 13: dynamic, Dynamic Data Validation List - Amazon Web …trainingworkingfiles.s3.amazonaws.com/dashboards/Dynamic... · Web viewDynamic, Dynamic Data Validation List By Mynda Treacy

FROM ‘your sheet name$’ ‘your sheet name$’Note: your sheet name is repeated twice on the FROM line.

n. Click OK and you should see the results of your query, which is a list of unique (DISTINCT) names from the Sales Person column of your Excel table.

o. Press the open door icon to take the data back to the Excel worksheetp. Select where you want it displayed:

q. Click ok. You should now see a list of your unique names from the Sales Person column.

Page 14: dynamic, Dynamic Data Validation List - Amazon Web …trainingworkingfiles.s3.amazonaws.com/dashboards/Dynamic... · Web viewDynamic, Dynamic Data Validation List By Mynda Treacy

r. Now when you add new data to the bottom of your Excel Table you simply need to save the workbook then refresh the connection to update your unique list of names.

3. Now you will have two tables in your Excel workbook; one is the Table you set up in step 1, and the other is the table generated by the Microsoft Query.

4. Give your unique list of names as a named range. I’ll call mine Unique_Names.5. Set up your Data Validation list and use the named range of your unique list of names as the

Source:

Page 15: dynamic, Dynamic Data Validation List - Amazon Web …trainingworkingfiles.s3.amazonaws.com/dashboards/Dynamic... · Web viewDynamic, Dynamic Data Validation List By Mynda Treacy

Now whenever you add new data to the bottom of the list all you need to do is save the workbook, refresh your connection and your data validation list will have an up to date list of names.

A big thank you to Roberto Mensa, for this tip.