Skip to content

Instantly share code, notes, and snippets.

Created November 28, 2022 22:41
What would you like to do?
This Excel Lambda function provides a simplified interface for creating lists of integers
from is the first integer in the list
to is the target integer in the list
step is the difference between successive integers
L =LAMBDA(from,to,[step],
_step, IF(ISOMITTED(step), IF(from > to, -1, 1), step),
//arguments should be single integers
_check, LAMBDA(x, OR(ROWS(x) + COLUMNS(x) <> 2, INT(x) <> x)),
//if any of these are TRUE, then there's an array somewhere
//array = no bueno
OR(_check(from), _check(to), _check(_step)),
_diff, MAX(from, to) - MIN(from, to),
_rows, ROUNDUP((_diff + 1) / ABS(_step), 0),
SEQUENCE( _rows, 1, from, _step)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment