LibreOffice Calc count the number of distinct occurrences

后端 未结 2 897
北荒
北荒 2021-02-15 14:25

What formula in LibreOffice Calc will count the number of distinct Week_Number occurrences? The answer should be 2.

2条回答
  •  南笙
    南笙 (楼主)
    2021-02-15 15:00

    This question has been asked many times before. One way is to enter the following formula in B6 and then press Ctrl+Shift+Enter:

    =SUM(1/COUNTIF(B2:B5,B2:B5))
    

    Other solutions are described at:

    • https://forum.openoffice.org/en/forum/viewtopic.php?f=9&t=47223
    • https://superuser.com/questions/238656/openoffice-get-distinct-values-from-column
    • https://askubuntu.com/questions/114732/different-values-in-one-column

    I prefer using a database such as LibreOffice Base instead, with a simple query:

    SELECT COUNT(DISTINCT Week_Number) FROM Weeks_Table;
    

提交回复
热议问题