# Functions (all)

## RelationCode

Function Name:
RelationCode
Description:
Returns coded numeric values which provide information about how 2 people are related.
Minimum FH Version:
2
No. of Parameters:
4
Return Type:
Number
Parameter 1:
A reference to an Individual.
Parameter 2:
A reference to an Individual.
Parameter 3:

The item of information required. Possible values are:

GENERATION
The number of generations separating the two individuals. For example, if Individual 2 is the uncle of Individual 1, they will be deemed to be one generation apart, and the value returned will be 1. If they were siblings, the value returned would be 0. Negative numbers are used to indicate that Individual 2 is of a younger generation than Individual 1. For example, a son or a nephew would be given a value of -1.
GENS_UP
The number of generations back you have to go, to find a common ancestor. For example, an uncle would have a value of 2 for this. A grandfather (a limiting case) would also have a value of 2. A daughter (another limiting case) would have a value of 0. A niece would have a value of 1. This function never returns negative values.
GENS_DOWN
Once you have established how many generations back you have to go to find a common ancestor, how many generations back down again do you have to find the 2nd Individual (or his/her spouse)? GENS_DOWN gives you this value. So, for example, an ordinary (first) cousin would have a GENS_UP value of 2 and a GENS_DOWN value of 2 also. A grandmother would have a GENS_UP value of 2 and a GENS_DOWN value of 0. A daughter would have a GENS_UP value of 0 and a GENS_DOWN value of 1. This function never returns negative values.
HALF
This value will be 1 if the two individuals (or their spouses) have only one common ancestor; and 0 if they have two common ancestors. The only possible values are 0 or 1.
SPOUSE_START
This value will be 1 if the two individuals are related by marriage via the spouse of the first individual. An example would be if the 2nd individual were the mother-in-law of the first individual. The only possible values are 0 or 1.
SPOUSE_END
This value will be 1 if the two individuals are related by marriage via the spouse of the second individual. An example would be if the 2nd individual were the son-in-law of the first individual. The only possible values are 0 or 1.
Parameter 4:
A number indicating whether the information you want concerns the closest relationship binding the 2 people, the 2nd closest relationship, the 3rd closest relationship, or whichever.

Use a value of 1, here, to represent the closest relationship, 2 to represent the 2nd closest, and so on.

Examples:

=RelationCode(["Individual"],%INDI%,GENERATION,1)