SetUnion
The SetUnion() function returns the set theoretic union of two ranges. In other words, it returns all distinct elements that appear in either range, or in both.
Related functions: SetDifference, SetIntersect
Syntax:
Qx.SetUnion(Range 1, Range 2, [ByRow])- In Excel with Quintessence add-in versions prior to 25.1, use:
SetUnion() - In the Quintessence Editor (Studio) using Quintessence language, use:
SetUnion() - In the Quintessence Editor (Studio) using Python language, use:
Qx.SetUnion()
ⓘ See parameter descriptions
| Range 1 | The first range of data. |
| Range 2 | The second range of data. |
| ByRow (optional) | Determines whether to treat multi-column input as rows (e.g., side-by-side items as pairs) or as a set of discrete entities. |
Remarks:
- The default parameters are:
- ByRow:
False
- ByRow:
Examples:
The examples provided below are based on fictitious data for illustrative purposes only.
> Example 1: Distinct numbers appearing in either range
Range 1 (A1:A6):
| 1 |
| 5 |
| 6 |
| 4 |
| 5 |
| 8 |
Range 1 (B1:B4):
| 7 |
| 5 |
| 4 |
| 3 |
Find all distinct numbers that appear in either Range 1 or Range 2:
=Qx.SetUnion(A1:A6, B1:B4)Result:
| 1 |
| 2 |
| 4 |
| 5 |
| 6 |
| 7 |
| 8 |
> Example 2: Treat multiple columns as single entities
Range 1 (A1:B5):
| CEB | BUY |
| MBD | SELL |
| KVJ | SELL |
| GMP | HOLD |
| YKG | HOLD |
Range 2 (C1:D4):
| PHO | BUY |
| GMP | |
| CEB | BUY |
| QGW | BUY |
Find all unique rows present in either Range 1 or Range 2:
=Qx.SetUnion(A1:B5, C1:D4, TRUE)Result:
| CEB | BUY |
| GMP | |
| GMP | HOLD |
| KVJ | SELL |
| MBD | SELL |
| PHO | BUY |
| QGW | BUY |
| YKG | HOLD |
> Example 3: Treat multiple columns as separate entities
Range 1 (A1:B2):
| CEB | KVJ |
| MBD | GMP |
Range 2 (C1:D2):
| PHO | CEB |
| GMP |
Find all unique entities that appear in either Range 1 or Range 2:
=Qx.SetUnion(A1:B2, C1:D2)Result:
| CEB |
| GMP |
| KVJ |
| MBD |
| PHO |
