How can I calculate a corrected wordcount in a field?

It’s easy to insert a field showing the number of words in a document. However, that figure includes all words, including headers, etc.

I have a short story template, and I’d like it to display the number of words in the story, minus the baseline words in the template, minus the address, title, etc. The titles will be variable length, but for simplicity here, I’d like a field that shows the result of the formula: LO # of words in document minus 152 (e.g., =Words - 152).

I see the way to enter a formula in a field, but I don’t know how to refer to the # of words.

Replies to a couple of similar queries seem to suggest this is not possible, but they’re not definitive, and that seems a strange result.

There is similar question: Word count of Text Body, excluding headings, captions & tables etc…

You could always select your story and see what number will that give. When you select text, LibreOffice will show how may words are selected. You can’t insert that number as a variable, but at least you can have it.

Maybe it can be done with a macro?

It can be done, but it is quite hidden. If you insert a field of type formula, either by going to the Insert|Fields → other or by pressing , you can use the document information variables that are available for text functions, WORD for the word count. So EvilOverlord was very close…
The available fields are documented under the help for text formulas here: Formula