Skip to content

Instantly share code, notes, and snippets.

@1504168
Created July 17, 2023 17:00
Show Gist options
  • Save 1504168/00546b5c399ecaffa76ebe92ac273ba7 to your computer and use it in GitHub Desktop.
Save 1504168/00546b5c399ecaffa76ebe92ac273ba7 to your computer and use it in GitHub Desktop.
Like excel SEQUENCE Function but for generating character.
//This will generate character sequence based on param.
//Example case =CHARSEQUENCE(2, 2,"AA",2) will give an output like this ={"AA","AC";"AE","AG"}
CHARSEQUENCE =LAMBDA(NumberOfRow, NumberOfColumn, [StartChar], [Step],
LET(
_StartCol, IF(ISOMITTED(StartChar), 1, COLUMN(INDIRECT(StartChar & 1))),
_StepCorrected, IF(ISOMITTED(Step), 1, Step),
_Array, SEQUENCE(NumberOfRow, NumberOfColumn, _StartCol, _StepCorrected),
_Result, MAP(
_Array,
LAMBDA(Curr,
LET(
Address, ADDRESS(1, Curr, 4),
RemoveRow, MID(Address, 1, LEN(Address) - 1),
RemoveRow
)
)
),
_Result
)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment