pub struct OffsetFn;Trait Implementations§
Source§impl Function for OffsetFn
Returns a reference shifted from a starting reference by rows and columns.
impl Function for OffsetFn
Returns a reference shifted from a starting reference by rows and columns.
OFFSET is volatile and returns a reference that can point to a single cell or a resized
range, depending on the optional height and width arguments.
§Remarks
rowsandcolsshift from the top-left ofreference.- If omitted,
heightandwidthdefault to the original reference size. - Non-positive target coordinates or dimensions return
#REF!. - Non-numeric offset/size inputs return
#VALUE!. - In value context, a 1x1 result returns a scalar; larger results spill as an array.
§Examples
title: "Move one row down and one column right"
grid:
A1: 10
B2: 42
formula: '=OFFSET(A1,1,1)'
expected: 42title: "Offset and resize a range"
grid:
A1: 1
A2: 2
A3: 3
B1: 4
B2: 5
B3: 6
formula: '=SUM(OFFSET(A1,1,0,2,2))'
expected: 16related:
- INDEX
- INDIRECT
- ADDRESS
faq:
- q: "What defaults are used when height and width are omitted?"
a: "OFFSET keeps the source reference size, then applies the row/column shift to that same-sized block."
- q: "When does OFFSET return #REF!?"
a: "It returns #REF! if the shifted start goes to row/column <= 0 or if requested height/width are non-positive."[formualizer-docgen:schema:start] Name: OFFSET Type: OffsetFn Min args: 3 Max args: 5 Variadic: false Signature: OFFSET(arg1: range@range, arg2: number@scalar, arg3: number@scalar, arg4?: number@scalar, arg5?: number@scalar) Arg schema: arg1{kinds=range,required=true,shape=range,by_ref=true,coercion=None,max=None,repeating=None,default=false}; arg2{kinds=number,required=true,shape=scalar,by_ref=false,coercion=NumberStrict,max=None,repeating=None,default=false}; arg3{kinds=number,required=true,shape=scalar,by_ref=false,coercion=NumberStrict,max=None,repeating=None,default=false}; arg4{kinds=number,required=false,shape=scalar,by_ref=false,coercion=NumberStrict,max=None,repeating=None,default=false}; arg5{kinds=number,required=false,shape=scalar,by_ref=false,coercion=NumberStrict,max=None,repeating=None,default=false} Caps: PURE, VOLATILE, RETURNS_REFERENCE, DYNAMIC_DEPENDENCY [formualizer-docgen:schema:end]
fn name(&self) -> &'static str
fn min_args(&self) -> usize
fn arg_schema(&self) -> &'static [ArgSchema]
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>>
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>
fn namespace(&self) -> &'static str
fn variadic(&self) -> bool
fn volatile(&self) -> bool
Source§fn aliases(&self) -> &'static [&'static str]
fn aliases(&self) -> &'static [&'static str]
fn function_salt(&self) -> u64
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>
Auto Trait Implementations§
impl Freeze for OffsetFn
impl RefUnwindSafe for OffsetFn
impl Send for OffsetFn
impl Sync for OffsetFn
impl Unpin for OffsetFn
impl UnsafeUnpin for OffsetFn
impl UnwindSafe for OffsetFn
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
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>
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>
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