I’m trying to utilize the MyUnique custom array function provided here The code of the function is
REM ***** BASIC *****
Option Explicit
Function MyUnique(InArray as Variant) as variant
Dim Row_Nr, lCounter, i as long
Dim DataType as integer
Dim Actual_Value, Out_Value as Variant
Dim OutArray() as Variant
For each Actual_Value in InArray
lCounter = 0
For each Out_Value in OutArray
If Out_Value = Actual_value then lCounter = lCounter + 1
If lCounter > 1 then exit For
next Out_Value
if lCounter = 0 then
Row_Nr = UBound(OutArray()) + 1
ReDim Preserve OutArray(Row_Nr)
OutArray(Row_Nr) = Actual_value
end if
next Actual_Value
Dim ResultArray(Row_Nr,0)
For i = 0 to Row_Nr
ResultArray(i,0) = OutArray(i)
next i
MyUnique = ResultArray()
End function
I’ve hit a snag in using it. If, for example, I enter{=MyUnique(A1:A10)} in B1:B10 and it only finds 5 unique values, the array formula only gets applied to B1:B5, which ends up truncating the list of results when a non-unique value in A1:A10 is changed to a new unique value. Is this something that can be overcome by tweaking the custom formula, or is the problem inherent to LO Calc?