XL: AppNote XE0210: Creating and Using TablesLast reviewed: February 2, 1998Article ID: Q99181 |
The information in this article applies to:
SUMMARYThe Application Note "Creating and Using Tables" (XE0210) is now available. This Application Note describes how to create one-input and two-input data tables using the Table command on the Data menu. It also discusses how you can use one-input and two-input tables to evaluate database information obtained using database functions and comparison or computed criteria. You can obtain this Application Note from the following sources:
MORE INFORMATIONThe full text is contained in this article.
Microsoft(R) Product Support Services Application Note (Text File) XE0210: CREATING AND USING TABLES Revision Date: 4/97 No DiskThe information in this Application Note applies to:
Overview of TablesWhen you create a formula, you may want to see the results of that formula with various values. Rather than recreating the formula each time that you want to test a new value, use the Table command on the Data menu to create a table. With the Table command, you can test a formula with different values, without having to retype or copy the formula for each value you want to test. For example, the formula =itemcost *8.1% will calculate tax on an item based on the item's cost (itemcost). If there are several items that you want to calculate tax for, you could type the formula in for each item, as shown in the example on page 2. Table created manually (with formulas displayed):
| A | B ---|------------|------- 1 |Item Cost |Tax 2 | 15|=A2*8.1% 3 | 17.5|=A3*8.1% 4 | 22.35|=A4*8.1%Table created manually (with values displayed):
| A | B ---|----------|------- 1 | Item Cost|Tax 2 | $15.00| $1.22 3 | $17.50| $1.42 4 | $22.35| $1.81To create the tables in these examples, you have to type or copy the formula for each value you want to evaluate. However, if you create a table with the Table command, you only have to type the formula once. Table created with the Table command (with formulas displayed):
| A | B ---|-----------|------------ 1 | Item Cost | =C1*8.1% <--- The formula is typed once. 2 | 15| =TABLE(,C1) <--- The Table command puts the results | here. 3 | 17.5| =TABLE(,C1) <--- 4 | 22.35| =TABLE(,C1) <---C1 represents a variable. The values in cells A2:A4 are substituted for C1, and the corresponding result is placed in cells B2:B4. Table created with the Table command (with values displayed):
| A B ---|-----------|------ 1 |Item Cost |Tax 2 | $15.00| $1.22 3 | $17.50| $1.42 4 | $22.35| $1.81The values displayed in cells A1 and B1 are number formats. To duplicate these values, do the following.
In Microsoft Excel 4.0 and earlier
In Microsoft Excel 5.0, 7.0, and 97
quotation marks). Creating a One-Input TableA one-input table allows you to test for changes in a formula based on one variable. One-input tables can be organized in two ways: column input or row input.
Entering the Input Values in a ColumnColumn input tables are organized with the values listed in a vertical array and the formulas listed horizontally. To create a simple column input table, do the following:
| A | B | C | D | E ---|---|-----|------------|-----------|----------- 1 | | | | | 2 | | |=B1+2 |=B1*2 |=INT(B1/2) 3 | | 10|=TABLE(,B1) |=TABLE(,B1)|=TABLE(,B1) 4 | | 13|=TABLE(,B1) |=TABLE(,B1)|=TABLE(,B1) 5 | | 14|=TABLE(,B1) |=TABLE(,B1)|=TABLE(,B1) 6 | | 19|=TABLE(,B1) |=TABLE(,B1)|=TABLE(,B1)One-input table with input values in a column (with values displayed):
| A | B | C | D | E ---|---|---|-----|----|-------- 1 | | | | | 2 | | |#+2 |#*2 |INT(#/2) 3 | | 10| 12|20 | 5 4 | | 13| 15|26 | 6 5 | | 14| 16|28 | 7 6 | | 19| 21|38 | 9The values displayed in cells C2, D2, and E2 are number formats. To duplicate these values, do the following:
In Microsoft Excel 4.0 and earlier
In Microsoft Excel 5.0, 7.0, and 97
Entering the Input Values in a RowRow input tables are organized with the variable values listed in a horizontal array and the formulas listed vertically. To create a simple row input table, do the following:
| A | B | C | D | E | F---|---|-------------|-------------|------------|------------|----------- | | | | | | 9 | | | 19.95| 20.98| 13.5| 10 10| |=A10*7.8% |=TABLE(A10,) |=TABLE(A10,)|=TABLE(A10,)|=TABLE(A10,) 11| |A10+A10*7.8% |=TABLE(A10,) |=TABLE(A10,)|=TABLE(A10,)|=TABLE(A10,)One-input table with row input cell (with values displayed):
| A | B | C | D | E | F ---|---|-------|-------|-------|-------|------ | | | | | | 9 | | |$19.95 |$20.98 |$13.50 |$10.00 10| |Tax | $1.56 | $1.64 | $1.05 | $0.78 11| |Total |$21.51 |$22.62 |$14.55 |$10.78The values displayed in cells B10 and B11 are number formats. To duplicate these values, do the following.
In Microsoft Excel 4.0 and earlier
In Microsoft Excel 5.0, 7.0, and 97
Creating a Two-Input TableA two-input table allows you to test how changes in two variables affect one formula. When you create a two-input table, you specify input cells for the Row Input Cell box and for the Column Input Cell box in the Tables dialog box. To create a simple two-input table, do the following:
NOTE: Due to character-based screen display limitations, the following 6- column table is shown in two parts. (Left 3 columns of a 6 column table)
| B | C | D ---|-----------|---------------|--------------- 14| =A14*2+A15| 6| 7 15| 1|=TABLE(A15,A14)|=TABLE(A15,A14) 16| 2|=TABLE(A15,A14)|=TABLE(A15,A14) 17| 3|=TABLE(A15,A14)|=TABLE(A15,A14) 18| 4|=TABLE(A15,A14)|=TABLE(A15,A14) 19| 5|=TABLE(A15,A14)|=TABLE(A15,A14)(Right 3 columns of a 6 column table.)
| E | F | G ---|----------------|---------------|--------------- 14| 8 | 9| 10 15| =TABLE(A15,A14)|=TABLE(A15,A14)|=TABLE(A15,A14) 16| =TABLE(A15,A14)|=TABLE(A15,A14)|=TABLE(A15,A14) 17| =TABLE(A15,A14)|=TABLE(A15,A14)|=TABLE(A15,A14) 18| =TABLE(A15,A14)|=TABLE(A15,A14)|=TABLE(A15,A14) 19| =TABLE(A15,A14)|=TABLE(A15,A14)|=TABLE(A15,A14)Two-input table (with values displayed):
| B | C | D | E | F | G | ---|---|---|---|---|---|---| 14| | 6| 7| 8| 9| 10| 15| 1| 8| 9| 10| 11| 12| 16| 2| 10| 11| 12| 13| 14| 17| 3| 12| 13| 14| 15| 16| 18| 4| 14| 15| 16| 17| 18| 19| 5| 16| 17| 18| 19| 20|Note that the result in cell C15 is 1*2+6, which equals 8. The values in cells B15:B19 are internally substituted into the column input cell (A14), and the values in cells C14:G14 are internally substituted into the row input cell (A15). The blank value in cell B14 is a number format. To duplicate this value, do the following.
In Microsoft Excel 4.0 and earlier
In Microsoft Excel 5.0, 7.0, and 97
Using Tables to Analyze Information in a DatabaseYou can use database functions in one-input and two-input tables to analyze values obtained from a database using both comparison and computed criteria. With Comparison Criteria Comparison criteria is the type of criteria most commonly used to extract or analyze information from a Microsoft Excel database. The value you place under the column heading in your criteria range is compared against the records in your database. If a record matches that value, it is extracted or included in the group of records to be analyzed using the database functions. For the following two examples, you will need to create a sample database and a sample criteria range. To create a sample database, type the following information in cells A1:C25 of a new worksheet. Then do the following:
In Microsoft Excel 4.0 and earlier
In Microsoft Excel 5.0, 7.0, and 97
| E | F | G ---|--------------|------|-------- 1 | Type of Soda |Month |Consumed 2 | | | In Microsoft Excel 4.0 and earlier
In Microsoft Excel 5.0, 7.0, and 97
In a One-Input TableTo find the cost of soda consumed per type the entire period, create a one- input table using the data from the database:
| E | F ---|---------------|---------------------------------------- 4 | First Quarter |=DSUM(Database,"Consumed",Criteria)*0.45 5 | Pepup |=TABLE(,E2) 6 | Diet Pepup |=TABLE(,E2) 7 | Colo |=TABLE(,E2) 8 | Diet Colo |=TABLE(,E2) 9 | Splash |=TABLE(,E2) 10| Diet Splash |=TABLE(,E2) 11| Lime-Up |=TABLE(,E2) 12| Diet Lime-Up |=TABLE(,E2)One-input table with data from database (with values displayed):
| E | F ---|---------------|------------------------ 4 | First Quarter |Money Spent on Beverages 5 | Pepup | $1,213.20 6 | Diet Pepup | $944.10 7 | Colo | $701.55 8 | Diet Colo | $304.65 9 | Splash | $592.65 10| Diet Splash | $470.25 11| Lime-Up | $450.90 12| Diet Lime-Up | $629.10The value displayed in cell F4 is a number format. To duplicate this value, do the following.
In Microsoft Excel 4.0 and earlier
In Microsoft Excel 5.0, 7.0, and 97
In a Two-Input TableFor the following example, use the sample database and criteria that you created on page 2. To find the cost of soda consumed per type per month, create a two-input table, as follows:
NOTE: Due to character-based screen display limitations, the following 4- column table is shown in two parts. (Left column of a 4 column table.)
| E ---|----------------------------------------- 14| =DSUM(Database,"Consumed",Criteria)*0.45 15| Pepup 16| Diet Pepup 17| Colo 18| Diet Colo 19| Splash 20| Diet Splash 21| Lime-Up 22| Diet Lime-Up(Right 3 columns of a 4 column table.)
| F | G | H ---|---------------|--------------|------------- 14| January |February |March 15| =TABLE(F2,E2) |=TABLE(F2,E2) |=TABLE(F2,E2) 16| =TABLE(F2,E2) |=TABLE(F2,E2) |=TABLE(F2,E2) 17| =TABLE(F2,E2) |=TABLE(F2,E2) |=TABLE(F2,E2) 18| =TABLE(F2,E2) |=TABLE(F2,E2) |=TABLE(F2,E2) 19| =TABLE(F2,E2) |=TABLE(F2,E2) |=TABLE(F2,E2) 20| =TABLE(F2,E2) |=TABLE(F2,E2) |=TABLE(F2,E2) 21| =TABLE(F2,E2) |=TABLE(F2,E2) |=TABLE(F2,E2) 22| =TABLE(F2,E2) |=TABLE(F2,E2) |=TABLE(F2,E2)Two-input table with data from database (with values displayed):
| E | F | G | H ---|----------------|--------|---------|-------- 14| Cost per Month |January |February |March 15| Pepup |$425.70 | $409.50 | $378.00 16| Diet Pepup |$342.90 | $402.30 | $198.90 17| Colo |$100.80 | $416.70 | $184.05 18| Diet Colo | $0.45 | $211.95 | $92.25 19| Splash |$321.75 | $221.85 | $49.05 20| Diet Splash |$227.70 | $124.20 | $118.35 21| Lime-Up |$159.30 | $20.25 | $271.35 22| Diet Lime-Up |$243.90 | $135.45 | $249.75The value displayed in cell E14 is a number format. To duplicate this value, do the following.
In Microsoft Excel 4.0 and earlier
With Computed CriteriaYou can also use computed criteria in one-input and twoinput tables to obtain and analyze values from a database. Computed criteria uses a formula to extract or obtain values for analysis. When you use computed criteria, be aware of the following:
To create a sample database, type the following information in cells A1:C15 of a new worksheet. Then use the correct procedure below.
| A | B | C ---|-----------|---------|------------ 1 | Product # |Date |Amount Sold 2 | 9865| 1/2/90| 91 3 | 9870| 1/12/90| 94 4 | 9875| 1/22/90| 76 5 | 9880| 2/1/90| 22 6 | 9865| 2/11/90| 82 7 | 9870| 2/21/90| 71 8 | 9870| 3/3/90| 50 9 | 9865| 3/13/90| 35 10| 9880| 3/23/90| 54 11| 9875| 4/2/90| 80 12| 9865| 4/12/90| 33 13| 9880| 4/22/90| 83 14| 9875| 5/2/90| 62 15| 9870| 5/12/90| 15 In Microsoft Excel 4.0 and earlier
In Microsoft Excel 5.0, 7.0, and 97
In Microsoft Excel 4.0 and earlier
In Microsoft Excel 5.0, 7.0, and 97
| E | F | G | H ---|-----------|-----|-------------|--------- 1 |Product # |Date |Amount Sold | 2 | TRUE In a One-Input TableIf you want to find how many items were sold each month, how many days a sale was made, and the maximum number of items sold on one day in each month, create a one-input table from this data, as follows:
NOTE: Due to character-based screen display limitations, the following 4- column table is shown in two parts. (Left 2 columns of a 4 column table.)
| E | F ---|-------|-------------------------------------- 5 | |=DSUM(Database,"Amount Sold",Criteria) 6 | 31412 |=TABLE(,H3) 7 | 31443 |=TABLE(,H3) 8 | 31471 |=TABLE(,H3) 9 | 31502 |=TABLE(,H3) 10| 31532 |=TABLE(,H3)(Right 2 columns of a 4 column table.)
| G | H ---|-----------------------------|------------------------------------- 5 | =DCOUNT(Database,,Criteria) |=DMAX(Database,"Amount Sold",Criteria) 6 | =TABLE(,H3) |=TABLE(,H3) 7 | =TABLE(,H3) |=TABLE(,H3) 8 | =TABLE(,H3) |=TABLE(,H3) 9 | =TABLE(,H3) |=TABLE(,H3) 10| =TABLE(,H3) |=TABLE(,H3)One-input table with computed criteria (with values displayed):
| E | F | G | H ---|---------|-------------|-------------|---------- 5 | | Total Amount| # of Entries| Max Entry 6 | January | 261| 3| 94 7 | February| 175| 3| 82 8 | March | 139| 3| 54 9 | April | 196| 3| 83 10| May | 77| 2| 62The values displayed in cells F5:H5 are number formats. To duplicate these values, do the following.
In Microsoft Excel 4.0 and earlier
In Microsoft Excel 5.0, 7.0, and 97
In a Two-Input TableIf you want to find how many items were sold each month for each product number, you can create a two-input table from this data, as follows:
NOTE: Due to character-based screen display limitations, the following 5- column table is shown in two parts. (Left 2 columns of a 5 column table.)
| E | F ---|----------------------------------------|------------- 12| =DSUM(Database,"Amount Sold",Criteria) |9865 13| 31412 |=TABLE(E2,H3) 14| 31443 |=TABLE(E2,H3) 15| 31471 |=TABLE(E2,H3) 16| 31502 |=TABLE(E2,H3) 17| 31532 |=TABLE(E2,H3)(Right 3 columns of a 5 column table.)
| G | H | I ---|---------------|--------------|------------- 12| 9870| 9875| 9880 13| =TABLE(E2,H3) |=TABLE(E2,H3) |=TABLE(E2,H3) 14| =TABLE(E2,H3) |=TABLE(E2,H3) |=TABLE(E2,H3) 15| =TABLE(E2,H3) |=TABLE(E2,H3) |=TABLE(E2,H3) 16| =TABLE(E2,H3) |=TABLE(E2,H3) |=TABLE(E2,H3) 17| =TABLE(E2,H3) |=TABLE(E2,H3) |=TABLE(E2,H3)Two-input table with computed criteria (with values displayed):
| E | F | G | H | I ---|----------|-----|-----|-----|---- 12| | 9865| 9870| 9875|9880 13| January | 91| 94| 76| 0 14| February | 82| 71| 0| 22 15| March | 35| 50| 0| 54 16| April | 33| 0| 80| 83 17| May | 0| 15| 62| 0 TO OBTAIN THIS APPLICATION NOTEThe following files are available for download from the Microsoft Software Library:
~ Xe0210.exe (size: 59639 bytes)For more information about downloading files from the Microsoft Software Library, please see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q119591 TITLE : How to Obtain Microsoft Support Files from Online Services- Application Notes are available by modem from the Microsoft Download Service (MSDL), which you can reach by calling (425) 936-6735. This service is available 24 hours a day, 7 days a week. The highest download speed available is 9600 bits per second (bps). For more information about using the MSDL, call (800) 936-4100 and follow the prompts. To obtain Xe0210, download Xe0210.exe. Xe0210.exe is a compressed, self- extracting file. After you download Xe0210, run it to extract the file it contains.
http://www.microsoft.com/worldwide/default.htm |
Additional query words:
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |