5 Replies Latest reply on Jun 2, 2014 3:22 AM by aaparvez

# Creating Ordered pair from list

### Title

Creating Ordered pair from list

### Post

I have list of values

a

b

c

Now i want to make ordered pair like below; (click here to know about ordered pair from wiki)

ab

ba

ac

ca

bc

cb

from customfunction website i was able to implement unordered pair (ab,ac,bc) but not ordered pair.(ab,ba,ac,ca)Below is given the unordered pair making funcion link;

Please kindly suggest me i can make ordered pair

• ###### 1. Re: Creating Ordered pair from list

Are your values always 3 or could they be less or more?

• ###### 2. Re: Creating Ordered pair from list
no. the value count can be single to 60
• ###### 3. Re: Creating Ordered pair from list

60 values will have 3540 ordered pairs

• ###### 4. Re: Creating Ordered pair from list

/*
OrderedPairs ( listOfValues ) custom function
Author: Daniele Raybaudi
*/

Let([
\$cfOrderedPairs = \$cfOrderedPairs + 1 ;
v1= GetValue ( listOfValues ; 1 );
vn = GetValue ( listOfValues ; \$cfOrderedPairs + 1 );
c = ValueCount ( listOfValues ) ;
next = RightValues ( listOfValues ; c - 1 )
];
Case(
\$cfOrderedPairs < c ; List ( v1 & vn ; List ( vn & v1 ; OrderedPairs ( listOfValues ) ) ) ;
Let ( \$cfOrderedPairs = "" ; If ( ValueCount ( next ) ; OrderedPairs ( next ) ) )
)
)

• ###### 5. Re: Creating Ordered pair from list

thanx a lot to raybaudi for your solution.