Google-sheets – Google Spreadsheets map cell to array

google sheets

I'm trying to save space on Google Sheets and what I need is something like this:

Say I have a value in A1, call it X. I need an array of length N that contains N copies of X.

 {X,X,X,X,X,X,X...} N times

I want to do this without filling my spreadsheet.

Alternatively, what I really want is a means of running filter on a single condition instead of a range of conditions.

So filter(A1:A5,0<1) should return A1:A5 because 0 is always less than 1. Currently, filter only prints A1 because 0<1 evaluates as {True} and not {True, True, True, True, True}

Best Answer

Short answer

what I really want is a means of running filter on a single condition instead of a range of conditions.

=FILTER(A1:A5,ROW(A1:A5))

Explanation

Nesting ROW with a range as argument, in FILTER as well on ARRAYFORMULA and other similar functions, returns an array of integers greater than 0 which each of them are coerced as TRUE, so the result is {TRUE;TRUE;TRUE;TRUE;TRUE}

NOTE: Google Sheets use semicolons as row separators. See Using arrays in Google Sheets