How to copy multiple cell values into one cell

Ok, so I have a list of values in a column. Basically, I need all the values to be copied into one cell, seperated by a comma, or a space.


I need all the numbers in the column on the left, to be pasted into the one highlighted top cell on the right. Is this possible?


Note: I am a novice at Excel and Numbers. I do not know how to script or do formulas or stuff like that.


Thank you.

User uploaded file

iMac

Posted on Jan 30, 2014 2:14 PM

Reply
9 replies

Jan 30, 2014 6:22 PM in response to samregan

Hi Sam,


The concatenate operator & will join strings together.


In B1 this formula:


=A1&", "&A2&", "


and so on to account for each cell in A.


Another way is to copy Column A into TextEdit. Then Edit > Find > Find and Replace.

With the cursor in the Find box, hold the option key and press enter. That will put a return character in.

In the Replace box, type a comma then a space.

Click on All.

Copy and paste into cell B1 in Numbers.


Regards,

Ian

Feb 1, 2014 2:14 PM in response to samregan

Sam,


One simple way to use a spreadsheet to convert a column of values into a string separated by a comma all in one cell goes like this:


User uploaded file


In cell B1 you bring in the value in A1 with the formula: =A1


In cell B2 you put the formula: B1&","&A2


Then fill the formula in B2 down the rest of the column by clicking once on B2, hovering your cursor over the bottom edge, and dragging the yellow dot that appears downward:


User uploaded file


The last cell in column B will have all the values in one cell, separated by a column.


Then you can command-c, select another cell, and Edit > Paste Formula Results if you need them somewhere else in the spreadsheet. Or just Edit > Paste in any text editor or email program if that's what you need.


SG

Feb 1, 2014 4:34 PM in response to samregan

To offer something different, here is an AppleScript that will do this if you're using Numbers 3.1.


  1. Copy script from below and paste into AppleScript Editor, then "hit the hammer" to compile.
  2. Select the cells with the numbers in column A.
  3. Click the green run button in AppleScript Editor.
  4. Paste the result in the cell at the top of the second column (or wherever you want in any application on the Mac that can accept text).


--select cells with values, run script, select destination in Numbers or elsewhere, paste

set delimiter to "," -- change to space or tab as needed

try

tell application "Numbers" to tell front document to tell active sheet

tell (first table whose class of selection range is range)

set my_selection to the selection range

tell my_selection

set paste_str to ""

repeat with this_cell from 1 to (count of cells)

tell cell this_cell

set not_blank to value is not missing value

if not_blank then set paste_str to paste_str & value & delimiter

end tell

end repeat

end tell

if length of paste_str < 1 then error -- no non-blank cells selected

set paste_str to (characters 1 thru -2 of paste_str) as text --remove trailing ,

end tell

end tell

on error

display dialog "Select Cells" buttons {"Cancel"}

end try


set the clipboard topaste_str

display notification "Ready to paste" with title "Numbers"


return paste_str--this line optional - for testing in AppleScript Editor

-- end of script



SG

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How to copy multiple cell values into one cell

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.