The Right Associative Difference Function

Available in Sets.xla, a Microsoft© Excel add-in.
Click "DifferenceRA",or scroll this page for DifferenceRA examples.
Click on another function in the browser window to read about it.
Click a function.

Difference Right Associative Difference Disjoint Union Intersection MakeList MakeSet MatrixToList NMakeList PowerSet SymmetricDifference Union

The Right Associative Difference Function

The DifferenceRA function returns a set from a range of cells.
The range of cells is called the argument of the function.
The DifferenceRA function can be called in one of two ways.
  1. From the function browser, above.
  2. Typing the function directly into a cell.

List Examples

In these examples, the contents of each cell in the argument is a simple list.

Two-Part Example
A1 B1 =DifferenceRA(A1:B1)
1,2,3,4,5 1,2,3 {4,5}


Three-Part Example
Cell Contents
A1 1,2,3,4,5
A2 1,2,3
A3 2
=DifferenceRA(A1:A3) {2,4,5}

Here is What is Going On

The 2 gets taken away from the 1,2,3. This leaves only the 1 and the
3 to take away from the 1,2,3,4,5 leaving 2,4,5.

Set Examples

In these examples, each cell in the argument is treated as a set.
The contents of each cell are treated as elements.

Two-Part Examples
Example A1 B1 =DifferenceRA(A1:B1)
1 {1,2,3,4,5} {1,2,3} {{1,2,3,4,5}}
2 {1,2,3,4,5},1 {1,2,3} {{1,2,3,4,5},1}
3 {1,2,3,4,5},1 {1,2,3},1 {{1,2,3,4,5}}


Three-Part Example
Cell Contents
A1 {1,2,3,4,5},{1,2,3},1
A2 {1,2,3}
A3 {1}
=DifferenceRA(A1:A3) {{1,2,3,4,5},1}

Rules for Selections

In the two-part and three-part examples, cells selected for differencing are contiguous.
Noncontigous cells may be differenced by reference to a workbook variable.
Cells A1 and A3 are assigned the workbook variable name, "WVName".

Workbook Variable Name Example
Cell Contents
A1 1,2,3,4,5
A2 1,2,3
A3 4
=DifferenceRA(WVName) {1,2,3,5}
=DifferenceRA(A1,A3) #VALUE!

If the cells are referenced directly, a #VALUE results.


Created on ... January 02, 2002