Skip to content

Instantly share code, notes, and snippets.

View andrewcharlesmoss's full-sized avatar
🖥️
Working on spreadsheets.

Andrew Moss andrewcharlesmoss

🖥️
Working on spreadsheets.
View GitHub Profile
@andrewcharlesmoss
andrewcharlesmoss / FLATTEN.txt
Created March 17, 2022 17:38
FLATTEN function to flatten all the values from one or more ranges into a single column
FLATTEN =
LAMBDA(array,
LET(
rows,ROWS(array),
columns,COLUMNS(array),
sequence,SEQUENCE(rows*columns),
quotient,QUOTIENT(sequence-1,columns)+1,
mod,MOD(sequence-1,columns)+1,
// v2
/* UPDATE 13/02/2022
Added columns argument and made each optional
*/
// Returns an array of unique random numbers
RANDUNIQUE =
LAMBDA([rows],[columns],[min],[max],