If you have information for the same set of units (for example, cases, subjects, or locations) in two different worksheets, you can use the By Columns option of merging worksheets to combine the information into a single worksheet so that each row contains information for the same unit. When you specify By Columns that contain the unit information for each worksheet, Minitab matches the values in the By Columns from each worksheet and puts them in ascending order. The remaining columns are sorted by the By Columns.
If you want to stack corresponding columns from multiple worksheets, using Stack Worksheets might be easier.
Suppose your company owns four plants, also called facilities. One worksheet contains net profit information for each plant. Another worksheet contains expense information for each plant. The column Plant in Worksheet 1 and the column Facility in Worksheet 2 refer to the same four locations. When you combine the worksheets, you want the profit and expense information for each location in the same row.
C1 | C2 |
---|---|
Plant | Profit |
3 | 23 |
1 | 24 |
2 | 29 |
4 | 30 |
C1 | C2 |
---|---|
Facility | Expense |
1 | 12 |
4 | 10 |
2 | 14 |
3 | 15 |
The following worksheet was created by merging Worksheet 1 and Worksheet 2 using Plant and Facility as By Columns. In the merged worksheet, all data for each location are on the same row.
C1 | C2 | C3 | C4 |
---|---|---|---|
Plant | Profit | Facility | Expense |
1 | 24 | 1 | 12 |
2 | 29 | 2 | 14 |
3 | 23 | 3 | 15 |
4 | 30 | 4 | 10 |
You can specify how you want to handle multiple occurrences of a value in the By Columns. One or both By Columns might contain a value that is repeated within the column. By default, Minitab creates separate rows for each occurrence in the merged worksheet.
If you select Include multiple obs, then the merged worksheet might pair rows of data that you did not intend to interpret as single observations. If you deselect Include multiple obs, then you might exclude important data from the merged worksheet.
In the following worksheets, the By Columns—Plant and Facility—both contain repeated values. Plant number 2 is represented twice in Worksheet 1. Facility number 4 is represented twice in Worksheet 2.
C1 | C2 |
---|---|
Plant | Profit |
2 | 23 |
1 | 24 |
2 | 29 |
4 | 30 |
C1 | C2 |
---|---|
Facility | Expense |
1 | 12 |
4 | 10 |
2 | 14 |
4 | 15 |
The following worksheets were created by merging Worksheet 1 and Worksheet 2, and selecting Include multiple obs for both worksheets, one worksheet, or neither worksheet.
C1 | C2 | C3 | C4 |
---|---|---|---|
Plant | Profit | Facility | Expense |
1 | 24 | 1 | 12 |
2 | 23 | 2 | 14 |
2 | 29 | 2 | 14 |
4 | 30 | 4 | 10 |
4 | 30 | 4 | 15 |
C1 | C2 | C3 | C4 |
---|---|---|---|
Plant | Profit | Facility | Expense |
1 | 24 | 1 | 12 |
2 | 23 | 2 | 14 |
4 | 30 | 4 | 10 |
4 | 30 | 4 | 15 |
C1 | C2 | C3 | C4 |
---|---|---|---|
Plant | Profit | Facility | Expense |
1 | 24 | 1 | 12 |
2 | 23 | 2 | 14 |
4 | 30 | 4 | 10 |
You can specify how you want to handle observations in the By Column of one worksheet that do not have a match in the By Column of the other worksheet. By default, Minitab creates rows for unmatched observations in the merged worksheet and displays missing value symbols where no match exists.
In the following worksheets, the By Columns—Plant and Facility—both contain unmatched values. Plant contains the value 5, which has no match in Facility. Facility contains the value 6, which has no match in Plant.
C1 | C2 |
---|---|
Plant | Profit |
1 | 23 |
2 | 24 |
3 | 29 |
4 | 30 |
5 | 31 |
C1 | C2 |
---|---|
Facility | Expense |
1 | 12 |
2 | 10 |
3 | 14 |
4 | 15 |
6 | 17 |
The following worksheets were created by merging Worksheet 1 and Worksheet 2, and selecting Include unmatched obs for both worksheets, one worksheet, or neither worksheet.
C1 | C2 | C3 | C4 |
---|---|---|---|
Plant | Profit | Facility | Expense |
1 | 23 | 1 | 12 |
2 | 24 | 2 | 10 |
3 | 29 | 3 | 14 |
4 | 30 | 4 | 15 |
5 | 31 | * | * |
* | * | 6 | 17 |
C1 | C2 | C3 | C4 |
---|---|---|---|
Plant | Profit | Facility | Expense |
1 | 23 | 1 | 12 |
2 | 24 | 2 | 10 |
3 | 29 | 3 | 14 |
4 | 30 | 4 | 15 |
* | * | 6 | 17 |
C1 | C2 | C3 | C4 |
---|---|---|---|
Plant | Profit | Facility | Expense |
1 | 23 | 1 | 10 |
2 | 24 | 2 | 12 |
3 | 29 | 3 | 14 |
4 | 30 | 4 | 15 |
By default, rows with missing values in either By Columns are omitted from the merged worksheet. You can include missing values within By Columns for both worksheets. The missing observations are then treated as distinct values. Missing By Column rows in one worksheet are matched with missing By Column rows in the other worksheet.