Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Split text to cells

I have read several threads and still wonder if it's possible to split text to different cells in an easy way.

In cell A1 I have pasted a lot of numbers.

Example: A1=4 9 23 41 70 74 75 95 113 140 144 149 163 182 187 211 231 249 254 260 265 278 284 309 327 328 334 339 352 358 383 401 402 422 440 445 459 474 486 498 503 523 543 557 566 581 587 612 630 631 637 662 680 681 708 728 748 749 754 774 794 814 836 863


And I would like to have the numbers like: A2=4, A3=9, A4=23, A5=70, A6=74 etc..


Or is it possible to paste the numbers so they appear in different cells on the first place?

MacBook Pro, OS X Yosemite (10.10.2)

Posted on Mar 29, 2015 5:15 AM

Reply
Question marked as Best reply

Posted on Mar 29, 2015 6:55 AM

copy the text into your favorite text editor.


replace the spaces with tabs


then paste back to Numbers. Tabs are the cell delimiter, new lines or carriage returns are row delimiters

3 replies

Mar 29, 2015 8:00 AM in response to Silen_

When pasting sometimes you will have better luck if you click once on the cell before pasting, rather than clicking twice.


If your source data is such that you always end up with the values all in one cell separated by one space, then you can easily separate them into separate cells with a script.


  1. Copy-paste the script into Script Editor (in Applications > Utilities).
  2. Select the cell(s) with the values that you need to place in separate cells.
  3. Click the run button in Script Editor
  4. Click a cell once and command-v to paste.


This will place to values in a column. If you want them spread across columns then just change the first 'return' in the script to 'tab'.


SG


tell application "Numbers"

tell document 1's active sheet

tell (first table whose selection range's class is range)

tell selection range

set pasteStr to ""

repeat with c in cells

set v to c's value

set pasteStr to pasteStr & my findReplace(v, " ", return) & return

end repeat

end tell

end tell

end tell

end tell


set the clipboard topasteStr

display notification "Click a cell once and command-v to paste"


to findReplace(tt1, f, r)

set AppleScript'stext item delimiters to f

set lst to tt1's text items

set AppleScript'stext item delimiters to r

set tt2 to lst as string

set AppleScript'stext item delimiters to r

return tt2

end findReplace

Split text to cells

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