# How do I prepend a string to a column of cells in Google Spreadsheets?

I imagine this is laughably simple but I just don't know what to do. I have a column (A) of cells with strings in them and I want to simply prepend each string in every cell with a web address:

A
--------
1| /foo/bar/
2| /foo/foo/
3| /foo/baz/
...


I want:

A
--------
1| http://foo.com/foo/bar/
2| http://foo.com/foo/foo/
3| http://foo.com/foo/baz/
...

-
possible duplicate of CONCATENATE a string with an ArrayFormula –  Jacob Jan Tuinstra Feb 19 '14 at 15:53

You can do that with a formula, so that e.g. column B will display the URL:

="http://foo.com" & A1


(the & is the string concatenation operator in Google Spreadsheets)

Put this formula in B1, and copy-paste it to other cells in the B column.

-

You can put this in another cell: ="http://foo.com" & A1

This will result in:

  A            | B
----------------------------------------
1| /foo/bar/   | http://foo.com/foo/bar/
2| /foo/foo/   | http://foo.com/foo/foo/
3| /foo/baz/   | http://foo.com/foo/baz/


Or, if you prefer, you can use the CONCATENATE function:

=CONCATENATE("http://foo.com",A1)


(CONCAT is the same, but it only concatenates two values, while CONCATENATE lets you do multiple, even in ranges.)

-

For completeness, use this formula to add in B1:

=ARRAYFORMULA("http://foo.com" & A1:A)


See similar post here on Web applications: CONCATENATE a string with an ArrayFormula

-