1
votes

I am using an arrayformula to add .png suffix to the text in column A. Right now it looks like this:

=arrayformula(A:A &".png" )

Since I want this to be a part of a macro, I won't manually be able to choose the exact range. So how do I limit the formula, to only add the suffix, if the cells in column A had any text in it, to begin with? Right now I end up with a lot of cells where it just says ".png" because the cell was empty.

I have tried playing around with =if(istext(A:A) but I couldn't figure out how to construct the statement. And maybe it is not the way to go?

arrayformula to add suffix

3

3 Answers

0
votes

try:

=ARRAYFORMULA(INDIRECT("A1:A"&COUNTA(A:A))&".png")

enter image description here

or shorter:

=ARRAYFORMULA(IF(A:A="",,A:A&".png")

or regex:

=ARRAYFORMULA(REGEXREPLACE(A:A, "(.+)", "$1.png"))
0
votes

See if this helps

=Arrayformula(if(len(A:A), A:A&".png",))
0
votes

Using below code

=ARRAYFORMULA(A1:A&".png")  

should do the thing.