Bug 164957 - UNIQUE function - notes on how this function works
Summary: UNIQUE function - notes on how this function works
Status: RESOLVED DUPLICATE of bug 165065
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
24.8.4.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-01-30 12:59 UTC by Jerzy Moruś
Modified: 2025-02-05 21:36 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Example of incorrect operation (16.55 KB, application/vnd.oasis.opendocument.spreadsheet)
2025-01-30 12:59 UTC, Jerzy Moruś
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jerzy Moruś 2025-01-30 12:59:54 UTC
Created attachment 198889 [details]
Example of incorrect operation

Incorrect operation.
If the function is to find unique occurrences in a range or matrix, and the range or matrix contain identical entries, the function returns the entire matrix or range of these entries instead of a single occurrence.
Example in the attached file:

Incorrect result construction.

A function validated in a single cell creates a result area or result matrix adjusted to present the result that concerns the current state of the data.
If the source data changes and the number of unique elements changes as well, the already created result range does not change. If there are fewer unique elements, the unused cells of the result range contain #N/A, and if there are more of these elements, only as many results will be shown as can be entered into the created result area.
Hence, I postulate the following:
If the author of the formula does not first select the range in which the function is to return results, the function should generate the dimension of the output area consistent with the dimension of the area of ​​the analyzed data.
Unused cells of this area should contain a string of characters given as an additional (optional) argument to the function and #N/A should be returned if this argument is omitted (as e.g. in the XLOOKUP() function).
Comment 1 Regina Henschel 2025-01-30 18:38:18 UTC
Topic: Incorrect result construction.

The fact, that the result area does not adapt to changes in the source range, is a missing feature of LibreOffice. The feature is called "dynamic array" in Excel. The request for this feature is in bug 127808.


Topic: Incorrect operation.

I do not understand whether and how it is different from the other topic.
Comment 2 Jerzy Moruś 2025-02-04 21:22:38 UTC
(In reply to Regina Henschel from comment #1)
 
> Topic: Incorrect operation.
> 
> I do not understand whether and how it is different from the other topic.

In line 1 we have the names of 10 different fruits, so the UNIQUE function's output line also returns 10 names.

In line 2, the name of one fruit is repeated ten times, but the UNIQUE function's output does not return one name, but repeats it ten times.

The third line shows that it is enough for the list to contain at least one different name, and the UNIQUE function will return only as many names as are actually unique.
Comment 3 Xisco Faulí 2025-02-05 21:32:42 UTC
it all depends on how many cells you select before you add the formula =UNIQUE(B4:K4;1). if you select the range B12:K12 and then you add the formula, then it will create one array per cell, which is the expected behaviour.
For the problem described in comment 1, it's already reported in bug 165065

*** This bug has been marked as a duplicate of bug 165065 ***
Comment 4 Xisco Faulí 2025-02-05 21:36:58 UTC
I mean, it's the expected behaviour at the moment, but yep, the root cause of the problem is the dynamic arrays not being implemented in LibreOffice at the moment, so it's correct to close this as a duplicated of bug 165065