Ever need to use Excel to process or analyze data that comes from another database? You typically export the data and then import it into Excel right? There is a better, more efficient, more accurate method: External Data Ranges. Read full text for more detail.
External Data ranges are ranges within Excel that contain a live link to another data source. This External Data range can be refreshed with a single click of the mouse. Excel can pull data in from a wide variety of other sources including various databases, the internet and more. While we introduce External Data ranges in this chapter we will use a Microsoft Access database as our data source.
Setting up an External Data range essentially “pulls” the data into Excel. It is the best method to use when you will frequently be importing data from the same table into the same workbook. It is also the most flexible method since you can use criteria, and only import records if they match the criteria. Conceptually, it is similar to running a query and brining the results of the query into Excel. In addition to using criteria, you may perform math, sum data, count data, and sort the data. In fact, this procedure uses a special program from Microsoft called “Query” or “Microsoft Query”.
By default, Query may not be installed, but the first time you use it Excel will automatically install it for you. We will use a full exercise for setting up external data.
The scenario is that we are the accounting manager in a private company, and our company uses Microsoft Access to retain all of the sales detail. We would like to generate an Excel workbook that will pull sales by item so that we can generate a nice graph for the monthly financial meeting. We decide to use external data to bring the information into Excel from Access.
The first step is to open Excel, and select Data -> Import External Data -> New Database Query. The first step of the wizard appears, as shown in Figure 13.

At this point, we should browse to the Access database that contains the table we are interested in, as shown in Figure 14.

Figure 14
Click OK to proceed, as shown in Figure 15.

Since the fields we want to include are shown on the right side of the dialog box, we will click Next to continue, as shown in Figure 16.

We will click Next to continue to the next step in the wizard, as shown in Figure 17.

This step of the wizard allows you to specify a sort order. In our case, we would like to see the records sorted by invoice number. So, we select the invoice_num field. You may specify an additional 2 fields to sort by. We click Next to move to the next step in the wizard, as shown in Figure 18.

At this point, it is important to note that you can either return the data to Excel, or modify the query using Microsoft Query. We will look at modifying queries using Microsoft Query in the next example. So, for this example, simply click Finish to proceed to the final step, as shown in Figure 19.

At this point, you can elect to place the data in an Existing worksheet or into a New worksheet. We will place the data into the Existing worksheet by clicking OK. The results of the external data are displayed in Figure 20.

Now that we have set up the external data range, we can refresh the excel spreadsheet at any time. When you click the refresh button
, all of the data from the Access table that meets the criteria will be pulled into the Excel workbook. We can base charts on the external data range, and update them by simply clicking the refresh button. So, as people use the Access database, and update it with new records, we can simply refresh our external data range to pull the most current data.