问题
Following this question, I want to know how I can specify a column/row of a specific sheet including a categorical variable, in Open/LibreOffice BASIC script/macro and get the unique list (i.e., set) of the values.
For example, consider the below dataset:
A, B, C
1. gender, age, height
2. man, 34, 180
3. woman, 23, 155
4. man, 54, 165
5. other, 37, 172
6. woman, 19, 169
Now I want to specify the column tag A
or header gender
in Sheet1
and get the unique values stored in an array woman, man, other
. It should be noted that
- empty cells must be ignored
- the length of the column is not known
I would appreciate if you could help me know how I can write a BASIC function which gets the column tag or header and the sheet name and returns the set of the categorical values as mentioned above. Thanks for your support in advance.
来源:https://stackoverflow.com/questions/60516128/grouping-a-column-of-categorical-variable-into-a-set-of-unique-values