The MakeMatrix Macro

Available in Sets.xla, a Microsoft© Excel add-in.
Click "MakeMatrix",or scroll this page for MakeMatrix examples.
Sets.xla toolbar MakeMatrix

Functions and Features
Link to Sets Home



The MakeMatrix macro converts a bracket-list or a set to a matrix.
The argument of the function is a single cell.
The cell must contain a set, a simple set or a bracket-list.

What is a bracket-list?

A bracket-list contains one or more bracket-pairs, "{}".
Bracket pairs must be part of every item.
Items in a bracket-list are separated from other items by a ",".
Examples
Cell Contains Complex List?
{1} Yes
1,2,a,b No
{1,2,a,b},{1,2,a,b} Yes
{} Yes
1,{2} No
{1,2,3,3}{1,2} No
{1,2,3,3},{1,2} Yes

MakeMatrix Examples

In MakeMatrix Example 1, the cursor starts in A1.
The MakeMatrix button will creates matrix A2:C5
Each bracket-item is converted to a matrix row.
When finished, the cursor is at A2.
Matrix Example 1
  A B C D
1 {1,2,3},{3,4,5},{6,7,8},{9,10,11}      
2 1 2 3  
3 3 4 5  
4 6 7 8  
5 9 10 11  

In MakeMatrix Example 2, the cursor starts in A1.
The MakeMatrix button creates matrix A2:C5
Each bracket-item is converted to a matrix row.
A null bracket-item, "{}" is converted to an empty row.
When finished, the cursor is at A2.
Matrix Example 2
  A B C D
1 {1,2,3},{},{3,4},{5,6,7}      
2 1 2 3  
3        
4 3 4    
5 5 6 7  

In MakeMatrix Example 3, the cursor starts in A1.
The MakeMatrix button creates matrix A2:C5
Each bracket-item is converted to a matrix row.
The length of each row is determined by bracket-item length.
When finished, the cursor is at A2.
Matrix Example 3
  A B C D
1 {1,2,3},{1,2},{1}      
2 1 2 3  
3 1 2    
4 1      
5        

Rules for Selections

Before pressing the MakeMatrix button, the cursor must reside in a cell.
If more than one cell is selected, the result will be "INVALID".
The contents of the cell must be a bracket-list or a set.


Created on ... December 27, 2001