Home > Net >  Simple way to fill in all the cells in a column with the same string
Simple way to fill in all the cells in a column with the same string

Time:11-15

Newby here. I would like a simple way, if it exists, to fill in a column with the same string/number.

The formula should not specify the number of rows (or the last row to fill in) but should propagate the string/number to the last cell of the column.

At the moment I'm using this formula:

=ArrayFormula({"Hello"}&$B:$B)

that writes my string ("Hello" in this case) concatenated with the content of its right cell. So this work (write just "Hello" in all the column cell) if the column B is empty :)

Can I simplify it?

CodePudding user response:

Use array formula with IF(). Try-

=ArrayFormula(IF(A:A<>"","Hello"&A:A,""))

Or BYROW() in this way.

=BYROW(A1:INDEX(A:A,COUNTA(A:A)),LAMBDA(x,"Hello"&x))

CodePudding user response:

try:

=INDEX(IFERROR(ROW(A:A)/0; "Hello"))

or just:

=INDEX(IF(ROW(A:A); "hello"))
  • Related