4

I have a list of fruit occurrences like this:

banana
banana
apple
orange
apple

And I want LibreOffice to give me a number of occurrences per fruit, for instance:

banana | 2
apple  | 2
orange | 1

How can I do this?

I guess that a pivot table would to require a column full of "1", and it is a pain to create this column.

1 Answer 1

6

There are (at least) two solutions:

  1. Using a pivot table;
  2. Using the COUNTIF function together with a list of distinct values.

1. Pivot table

The following pivot table layout...

enter image description here

will give you the following output:

enter image description here

2. COUNTIF and distinct values

Another approach involves the COUNTIF function. You can create the "result table" in two simple steps:

  1. Create a list of distinct values (fruit names) using a standard filter:

    Create list of distinct values

  2. Apply the countif function to all of the resulting distinct values like this:

    =COUNTIF($A$2:$A$6;A9)

    enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .