I have a couple hundred of cells in Excel I would like to concatenate into a single string. Is there a simpler method of doing this than going through them one by one manually in order to type them into CONCATENATE(A1, A2, ....)
?
CONCATENATE(A1:A255)
does not work.
PowerShell it!
Open the text file copy and paste
"To quickly select cells you can press CTRL and click on cells you want to be included in the concatenate function. Example, Select a cell Type =concatenate( in formula bar Press and hold CTRL button and click cells to be included. Release CTRL button Type ) in formula bar and press Enter"
My preferred method is to cut-and-paste the values into an editor that allows regular expressions, then I simply remove the tabs (or spaces) with a find and replace on my current selection.
You can also use this to insert commas, whitespace, or whatever you want.
It's a ton faster than typing
=concatenate(A1,",","A2",",",......)
See this blog post here: http://www.dullsharpness.com/2011/11/14/excel-vba-range-to-csv-range2csv-function/
You can use it like so, e.g. with a pipe delimiter:
Access your VBA editor using
Alt+F11
and drop it into a module.Code excerpt is here:
It isn't purely Excel, but there is an easy way to do this with Word.
where the values that you would like to concantenate start in row 2 column 3 of your sheet
This VBA function will concatenate the contents of cells, with an optional delimiter, if needed. Copy it into a standard module: