Functions Utility

Join

The Join() function combines rows from two ranges of data into a single range. It works similarly to the join functionality in SQL (Structured Query Language used for querying databases).

Related functions: MultiJoin


Syntax:

Qx.Join(Range 1, Range 2, [Range 1 Columns], [Range 2 Columns], [Join Type], [Output])
  • In Excel with Quintessence add-in versions prior to 25.1, use: Join()
  • In the Quintessence Editor (Studio) using Quintessence language, use: Join()
  • In the Quintessence Editor (Studio) using Python language, use: Qx.Join()
 See parameter descriptions

Range 1The first contiguous range.
Range 2The second contiguous range.
Range 1 Columns
(optional)
The column(s) in the first range to join on. Ignored for cross joins.
Range 2 Columns
(optional)
The column(s) in the second range to join on. Ignored for cross joins.
Join Type
(optional)
Specifies the type of join:
• Inner
• Outer
• Left
• Right
• Cross
See examples for details.
Output
(optional)
Specifies the columns to include in the result.

Remarks:

  • The default parameters are:
    • Range 1 Columns: C1.
    • Range 2 Columns: C1.
    • Join Type: Inner
    • Output: * (all columns).

Examples:

The examples provided below are based on fictitious data for illustrative purposes only.

> Example 1: Inner join with multiple keys


Range1 (A1:D6):

Account 1AssetCountryHolding
5060GMPIndia800
5060GMPBrazil3000
5060PHOChina1300
5060PHOSpain700
5060PHOEcuador1200


Range2 (F1:I6):

Account 2AssetCountryHolding
5090GMPIndia50000
5090GMPRussia45000
5090PHOLima7000
5090PHOChina15000
5090PHOSpain9500

We join on columns 2 and 3 (Asset and Country) from both ranges.

Inner join:
Matches only rows with matching keys.

=Qx.Join(A2:D6,F2:I6,"C2,C3","C2,C3","Inner","C2,C3,C4,C8")

Result:

GMPIndia80050000
PHOChina130015000
PHOSpain7009500
> Example 2: Left join with multiple keys


Range1 (A1:D6):

Account 1AssetCountryHolding
5060GMPIndia800
5060GMPBrazil3000
5060PHOChina1300
5060PHOSpain700
5060PHOEcuador1200


Range2 (F1:I6):

Account 2AssetCountryHolding
5090GMPIndia50000
5090GMPRussia45000
5090PHOLima7000
5090PHOChina15000
5090PHOSpain9500

We join on columns 2 and 3 (Asset and Country) from both ranges.

Left join:
Returns all matched rows plus all unmatched rows from Range1.

=Qx.Join(A2:D6,F2:I6, "C2,C3", "C2,C3", "Left", "C2,C3,C4,C8")

Result:

GMPIndia80050000
GMPBrazil3000
PHOChina130015000
PHOSpain7009500
PHOEcuador1200
> Example 3: Right join with multiple keys


Range1 (A1:D6):

Account 1AssetCountryHolding
5060GMPIndia800
5060GMPBrazil3000
5060PHOChina1300
5060PHOSpain700
5060PHOEcuador1200


Range2 (F1:I6):

Account 2AssetCountryHolding
5090GMPIndia50000
5090GMPRussia45000
5090PHOLima7000
5090PHOChina15000
5090PHOSpain9500

We join on columns 2 and 3 (Asset and Country) from both ranges.

Right join:
Returns all matched rows plus all unmatched rows from Range2:

=Qx.Join(A2:D6, F2:I6, "C2,C3", "C2,C3", "Right", "C6,C7,C4,C8")

Result:

GMPIndia80050000
GMPRussia45000
PHOLima7000
PHOChina130015000
PHOSpain7009500
> Example 4: Outer join with multiple keys


Range1 (A1:D6):

Account 1AssetCountryHolding
5060GMPIndia800
5060GMPBrazil3000
5060PHOChina1300
5060PHOSpain700
5060PHOEcuador1200


Range2 (F1:I6):

Account 2AssetCountryHolding
5090GMPIndia50000
5090GMPRussia45000
5090PHOLima7000
5090PHOChina15000
5090PHOSpain9500

We join on columns 2 and 3 (Asset and Country) from both ranges.

Outer join:
Returns all matched rows plus all unmatched rows from both ranges. The IsNullOrEmpty() function is used to ensure that we populate the country and asset whenever it is blank from Range1.

=Qx.Join(A2:D6, F2:I6, "C2,C3", "C2,C3", "Outer", "if(IsNullOrEmpty(C2), C6, C2),if(IsNullOrEmpty(C3), C7, C3),C4,C8")

Result:

GMPIndia80050000
GMPBrazil3000
PHOChina130015000
PHOSpain7009500
PHOEcuador1200
GMPRussia45000
PHOLima7000
> Example 5: Cross join with multiple keys


Range1 (A1:D3):

Account 1AssetCountryHolding
5060GMPIndia800
5060GMPBrazil3000


Range2 (F1:I2):

Account 2AssetCountryHolding
5090GMPIndia50000

We join on columns 2 and 3 (Asset and Country) from both ranges.

Outer join:
Combines all rows from both ranges. The match columns can be left empty as they are ignored. We make use of a smaller range in this example for demo purposes only.

=Qx.Join(A2:D3, F2:I2, , , "Cross", "C2,C3,C4,C6,C7,C8")

Result:

GMPIndia800GMPIndia50000
GMPBrazil3000GMPIndia50000