Counting Amount of Words in A Textbook in Numbers

Hi All,


Frequent browser when I need Numbers help and I think I am finally over my head. Long story short, I could not find a word processor I liked for note taking so I decided to make one for myself in Numbers. This way I can use a different page for each lecture, but have all the lectures in one document. This is essentially what the template looks like.


User uploaded file


I was doing a little playing around, and thought it would be nice to utilize Numbers to its full potential, my idea was to take the data from the "Lecture Notes" box and count how many words were in it. The only problem is it is not a table, and the notes will not be in a cell. As of now, I would have to paste the notes into the table at the very bottom right (where it says Word Count Test). The table above it uses the formula to count the word in the table below it:


=LEN(TRIM(B))-LEN(SUBSTITUTE(B," ",""))+1


Is it possible to count the amount of words in a text box? Specifically the "Lecture Notes" box. Or is there another way to facilitate this that would prevent me having to copy and paste everything every time? Thank you for the help guys. Also any advice on how else I can make this document even better would be appreciated, ideas like the world count or something.

MacBook Pro, OS X El Capitan (10.11.1)

Posted on Jan 12, 2016 1:55 PM

Reply
4 replies

Jan 12, 2016 3:25 PM in response to Tomdaechsel

Numbers cannot count words or characters or perform any operation on a text box. It may be able to to so using an Applescript (but that is a BIG may).


You can use tables instead... for instance, instead of using a textbook, use a table that has one column and one row. Expend the size of the single-cell table so it is as large as the text box. select the contents of the text box, copy


double click the cell in the single-cell table, paste

User uploaded file

now you can count words... kind of. It is easy to defeat the word counting strategy:

User uploaded file

LEN(Lecture Notes::A1)−LEN(SUBSTITUTE(Lecture Notes::A1," ", ))




because a single word followed by a new line will not have any spaces. same with words separated by punctuation


you can improve this method as needed.


I am posting an example here:

https://www.dropbox.com/s/idg9fkm1ubbfw39/WordCounting.numbers?dl=0

Jan 12, 2016 4:54 PM in response to Tomdaechsel

Tomdaechsel wrote:


Is it possible to count the amount of words in a text box? Specifically the "Lecture Notes" box.


Sure! If Lecture Notes is the first text box on the sheet you can do this with a single line of AppleScript.


tell application "Numbers" to tell front document to tell active sheet to count the first text item's object text's words


You can get a little more sophisticated and have the script check for the box that starts with "Lecture" (or "Introduction", etc) and also display a dialog with the results.


property firstWord : "Lecture"

tell application "Numbers"

tell front document to tell active sheet

set theBox to first text item whose object text's first word is firstWord

display dialog ((count theBox's object text's words) as text) & " words" buttons "OK"

end tell

end tell



If you're not familiar with AppleScript it's really easy to use if the script has already been written, as here. Just copy-paste the script you want to use from the forum into Script Editor (in the Applications > Utilities folder). Make sure your Numbers document is open to the sheet that contains your text box and click the triangle 'run' button in Script Editor. That's it!


If you find you want to use a script often you can move it into the Script menu or the Numbers > Services menu and attach it to a keyboard shortcut. Post back if you become interested in that.


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.

Counting Amount of Words in A Textbook in Numbers

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