4

I would like to know if there is a function in LibreOffice Calc that could generate a list from multiple columns or cell ranges.

Assume I have the following unique data

+------+------+------+
| col1 | col2 | col3 |
+------+------+------+
|    1 | a    | +    |
|    2 | b    | -    |
|    3 | c    | *    |
|    4 | d    | /    |
|    5 | e    |      |
|      | f    |      |
|      | g    |      |
+------+------+------+

and I want to create a list of unique rows on another sheet, that would look like

+-----+---+---+
| 1   | a | + |
| 1   | a | - |
| 1   | a | * |
| 1   | a | / |
| 1   | b | + |
| 1   | b | - |
| ... |   |   |
+-----+---+---+

So simply said, take every unique value from col3 and combine with col2 and col1. If you finished, take another unique value from col2, run through every col3 values and create another rows. After that, take the next col1 unique value and repeat all over again.

As a result I would gain 5*7*4 = 140 unique rows in this example.

What if I need more columns, more unique properties, etc.. Thank you!

praet0ri4n
  • 53
  • 1
  • 8

1 Answers1

0

There may be a pure LO Calc solution, but it is easy with LO Base.

  1. Create a table named col1 with one Integer field called col1, the primary key.
  2. Create two more similar tables for col2 and col3 as Text field type.
  3. Open the tables and add the records to each.
  4. Create a query in Design view that includes each of the three tables, with no relationships.

Query1

Now the results of the query can be moved to Calc by dragging and dropping.

query_to_calc

Jim K
  • 12,824
  • 2
  • 22
  • 51