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

Content into cells

I Want split the content in separate cell, especially the numbers


Thank you!

User uploaded file

Posted on Nov 24, 2015 8:16 AM

Reply
Question marked as Best reply

Posted on Nov 24, 2015 9:41 AM

If the number is always either at the end of row or in the penultimate position, then you can use the script below to extract them all and paste them into a second column. (It's much easier than it sounds, basically cut-paste, then select, click, and paste results).


  1. Copy-paste script into Script Editor (in Applications > Utilities)
  2. Select the cells with the data.
  3. With the cells selected, click the triangle 'run' button.
  4. Click once in the top cell of a new column.
  5. Command-v to paste.


This is the result I get here. When pasting I clicked once in B1.


User uploaded file


SG



tell application "Numbers"

tell front document

tell active sheet

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

set selRng to selection range

set pasteStr to ""

repeat with aCell in selRng's cells

tell aCell

set v to aCell's value

set ww to v's words

set lw to ww's item -1

if my isNum(lw) is true then

set pasteStr to pasteStr & lw & return

else

set pasteStr to pasteStr & ww's item -2 & return

end if

end tell

end repeat

end tell

end tell

end tell

end tell

set the clipboard topasteStr

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


--return pasteStr -- uncomment this line to debug


to isNum(aValue)

try

aValue * 1

return true

on error

return false

end try

end isNum

3 replies
Question marked as Best reply

Nov 24, 2015 9:41 AM in response to Abraham.G

If the number is always either at the end of row or in the penultimate position, then you can use the script below to extract them all and paste them into a second column. (It's much easier than it sounds, basically cut-paste, then select, click, and paste results).


  1. Copy-paste script into Script Editor (in Applications > Utilities)
  2. Select the cells with the data.
  3. With the cells selected, click the triangle 'run' button.
  4. Click once in the top cell of a new column.
  5. Command-v to paste.


This is the result I get here. When pasting I clicked once in B1.


User uploaded file


SG



tell application "Numbers"

tell front document

tell active sheet

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

set selRng to selection range

set pasteStr to ""

repeat with aCell in selRng's cells

tell aCell

set v to aCell's value

set ww to v's words

set lw to ww's item -1

if my isNum(lw) is true then

set pasteStr to pasteStr & lw & return

else

set pasteStr to pasteStr & ww's item -2 & return

end if

end tell

end repeat

end tell

end tell

end tell

end tell

set the clipboard topasteStr

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


--return pasteStr -- uncomment this line to debug


to isNum(aValue)

try

aValue * 1

return true

on error

return false

end try

end isNum

Nov 26, 2015 11:57 AM in response to Abraham.G

Abraham.G wrote:


Please share the spreadsheet with me, with a link to it,


Not sure what you are asking. I didn't provide an example spreadsheet; you did.🙂 I provided a script to use with your spreadsheet. So you already have everything you need. Full instructions on how to use the script (it's easy) are already provided above.


SG

Content into cells

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