pub struct UniqueFn;Trait Implementations§
Source§impl Function for UniqueFn
Returns distinct rows or columns from a range.
impl Function for UniqueFn
Returns distinct rows or columns from a range.
UNIQUE preserves first-occurrence order and can optionally return only values that appear once.
§Remarks
- Defaults:
by_col=FALSE,exactly_once=FALSE. - With
by_col=FALSE, uniqueness is evaluated by full rows. - With
by_col=TRUE, uniqueness is evaluated by full columns. - With
exactly_once=TRUE, only entries with frequency 1 are returned. - Result spills as an array.
§Examples
title: "Unique values by row"
grid:
A1: "A"
A2: "A"
A3: "B"
A4: "C"
formula: '=UNIQUE(A1:A4)'
expected: [["A"],["B"],["C"]]title: "Only values that appear once"
grid:
A1: 1
A2: 1
A3: 2
A4: 3
formula: '=UNIQUE(A1:A4,FALSE,TRUE)'
expected: [[2],[3]]related:
- FILTER
- SORT
- SORTBY
faq:
- q: "What does exactly_once=TRUE change?"
a: "Instead of returning first occurrences, UNIQUE returns only rows or columns whose full key appears exactly one time."
- q: "How does by_col affect uniqueness checks?"
a: "by_col=FALSE compares entire rows, while by_col=TRUE compares entire columns and spills unique columns."[formualizer-docgen:schema:start] Name: UNIQUE Type: UniqueFn Min args: 1 Max args: variadic Variadic: true Signature: UNIQUE(arg1: range@range, arg2?: logical@scalar, arg3?…: logical@scalar) Arg schema: arg1{kinds=range,required=true,shape=range,by_ref=true,coercion=None,max=None,repeating=None,default=false}; arg2{kinds=logical,required=false,shape=scalar,by_ref=false,coercion=Logical,max=None,repeating=None,default=true}; arg3{kinds=logical,required=false,shape=scalar,by_ref=false,coercion=Logical,max=None,repeating=None,default=true} Caps: PURE [formualizer-docgen:schema:end]
fn name(&self) -> &'static str
fn min_args(&self) -> usize
fn variadic(&self) -> bool
fn arg_schema(&self) -> &'static [ArgSchema]
Source§fn eval<'a, 'b, 'c>(
&self,
args: &'c [ArgumentHandle<'a, 'b>],
_ctx: &dyn FunctionContext<'b>,
) -> Result<CalcValue<'b>, ExcelError>
fn eval<'a, 'b, 'c>( &self, args: &'c [ArgumentHandle<'a, 'b>], _ctx: &dyn FunctionContext<'b>, ) -> Result<CalcValue<'b>, ExcelError>
The unified evaluation path. Read more
fn namespace(&self) -> &'static str
fn volatile(&self) -> bool
Source§fn aliases(&self) -> &'static [&'static str]
fn aliases(&self) -> &'static [&'static str]
Optional list of additional alias names (case-insensitive) that should resolve to this
function. Default: empty slice. Implementors can override to expose legacy names.
Returned slice must have ’static lifetime (typically a static array reference).
fn function_salt(&self) -> u64
Source§fn eval_reference<'a, 'b, 'c>(
&self,
_args: &'c [ArgumentHandle<'a, 'b>],
_ctx: &dyn FunctionContext<'b>,
) -> Option<Result<ReferenceType, ExcelError>>
fn eval_reference<'a, 'b, 'c>( &self, _args: &'c [ArgumentHandle<'a, 'b>], _ctx: &dyn FunctionContext<'b>, ) -> Option<Result<ReferenceType, ExcelError>>
Optional reference result path. Only called by the interpreter/engine
when the callsite expects a reference (e.g., range combinators, by-ref
argument positions, or spill sources). Read more
Source§fn dispatch<'a, 'b, 'c>(
&self,
args: &'c [ArgumentHandle<'a, 'b>],
ctx: &dyn FunctionContext<'b>,
) -> Result<CalcValue<'b>, ExcelError>
fn dispatch<'a, 'b, 'c>( &self, args: &'c [ArgumentHandle<'a, 'b>], ctx: &dyn FunctionContext<'b>, ) -> Result<CalcValue<'b>, ExcelError>
Dispatch to the unified evaluation path with automatic argument validation.
Auto Trait Implementations§
impl Freeze for UniqueFn
impl RefUnwindSafe for UniqueFn
impl Send for UniqueFn
impl Sync for UniqueFn
impl Unpin for UniqueFn
impl UnsafeUnpin for UniqueFn
impl UnwindSafe for UniqueFn
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more