The SymmetricDifference Function
Available in Sets.xla, a Microsoft© Excel add-in.
Click "SymmetricDifference",or scroll this page for SymmetricDifference
examples. Click on another function in the browser window to read about it.
The SymmetricDifference Function
The SymmetricDifference function returns a set.
The function can be called in one of two ways.
- From the function browser, above.
- Typing the function into directly into a cell.
Examples
Two-Part Example
| A1 |
B1 |
SymmetricDifference(A1:B1) |
| 1,2,3
|
2,3,4
|
{1,4}
|
Three-Part Example
| Cell |
Contents |
| A1
|
1,4,5,7
|
| A2
|
2,4,6,7
|
| A3
|
3,5,6,7
|
| =SymmetricDifference(A1:A3)
|
{1,2,3,7}
|
Rules for Selections
In the two-part example above, SymmetricDifference selects everything in
the first cell which is not in the second and puts it together with
everything in the second cell which is not in the first. This operation
is both commutative and associative and the way it generalizes is to
select precisely those mathematical objects which occur in an odd number of sets.
As shown in the three-part example, each of 1, 2 and 3 occurs in precisely one
of the selected cells. One is an odd number so each of 1, 2 and 3 occurs in the
symmetric difference. Also, the 7 is included because it occurs in three of the
cells.
Created on ... December 30, 2001