当前位置: 动力学知识库 > 问答 > 编程问答 >

Libreoffice Calc - generate list as combination of multiple columns or cell ranges

问题描述:

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!

网友答案:

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.

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

分享给朋友:
您可能感兴趣的文章:
随机阅读: