Calculate command as in Word

What I want to do is easy, as I wrote: just copy the text and paste it into the Calculator app, and it does the same thing - including placing the result in the clipboard. Not a big deal, it’s just more convenient having it directly in the word processor.

One example of how I use this feature is during tax time. I have a Word document with a long table of expenses, which I update for the current year. That involves arithmetic on lists of numbers (either positive or negative), and then multiplying by a percentage to figure out, say, the percentage of our household expenses I can deduct for my home office/studio.

I’m sure there will be other features/commands I need to find as I move over to Libre Office. The reason I posted to ask about this one is that… I wanted to add something up! (But I’m not working on taxes now, thank goodness.)

Then you can use the calculation functions of a table, Mike Kaganski alluded to it in his earlier comment, Calculate command as in Word - #10 by mikekaganski.

To sum see Calculating Cell Totals in Tables . Note that there are other functions available for calculating within a table, after pressing F2 click the fx icon to see the list.
.
To convert a list of numbers, such as you described, to a table just click Table > Convert > Text to table.
.
The Writer Guide is a handy reference, download from English documentation | LibreOffice Documentation - LibreOffice User Guides

Yes, I know you can do it in tables like you would in a spreadsheet, but that’s not exactly what I was looking for.

I just like having a basic calculator inside the word processor because I’m not a spreadsheet GUY.

So I’ll use the Calculator app instead. It’s just a little less convenient, but it’s fine.

Okay, I think we’re done here.

The “Calculate” command in menu Tools works on a selection inside a paragraph. This selection needs to be a valid expression including operators, e.g. 12*17+4. The command puts the calculation result into the clipboard. It does not automatically replace the selection. From the clipboard you can insert it into the document with the usually Ctrg+V, to a new place or as replacement of the selection. The command does not perform a default addition of the selection, in case there are no operators.

So LibreOffice has a “Calculate” command, but it works a little bit different than in Word.

2 Likes

Should there be a fancy syntax for epressions accepted by the tool?
What restrictions concerning standard functions?
Why should SIN(literal argument) be accepted, but PI() not?
See attachment.
disask114902_25_refutation.odt (150.8 KB)

I think you’re saying mostly the same thing, but in Word if you type this (with returns between the numbers):

1
2
(2)

…then select them all and issue the Calculate command, the resulting answer 1 will be in the clipboard and it’ll show in the bar at the bottom of the window. (Obviously numbers in parenthesis are subtracted.)

Similarly, if you select 2*3 or 12/2 (they have to be in the same paragraph), 6 will be the result.

But I’ll have to find the command you’re talking about in Libre, because it sounds like it’s almost the same thing.

One other point (you’ll have to excuse me for being new to Libre): in Word, you can hold Option while selecting and restrict the selection’s horizontal boundaries, not just the vertical ones as normal.

Thanks.

Sorry. I’m not interested in MS™ Word™, and didn’t use it for more than 20 years.
To regard numbers in parentheses negative is an idiotic misuse of parentheses which are indispensable for reasonable purposes. On the same level is it to interpret line breaks or paragraph breaks as arithmetic operators.

LibreOffice Writer simply isn’t Word™ though it has to support fancy “formats” in some cases…

Typing
5 `Enter` (3) `Enter` 428 `Enter` `3/4` Enter,
then selecting a bunch of lines, 
finding a menu item and a submenu item by clicking,
losing (and later regretting to have lost) the previous content of the clipboard, 
then (most likely) deleting what originally was entered
and eventually pasting a result from the clipoard somewhere,

is surely more complicated, less powerful, and less intuitive
than

typing 
5 - 3 + 428 + 3/4
selecting what was typed
(copying it to the clipboard possibly for later use)
and clicking a sensitive area of a toolbar.

If a user can accept to need custom code, the solution I suggested is much better than what MS™ Word™ can do and also better than what LibO Writer currently supports with >Tools>Calculate .

If a user can’t accept custom code, they will need to use the tools as they are, and to accept the shortcomings - or wait for an enhancement of the tool.
See also the enhanced attachment to my answer below.

1 Like

Libre Office is called “Office” because it’s an alternative to MS Office, and Word is the gold standard for word processors. My objection isn’t to the product, it’s to MS’ licensing policies and not having support for paying customers. And because you have to license a whole suite of stuff you don’t want just to get the word processor - which I’ve been using for decades as a magazine editor/writer.

There is nothing unreasonable about using parenthesis for negative numbers. It’s standard in accounting. And using line breaks for operators is very useful IF YOU’RE TYPING SOMETHING AND YOU WANT TO ADD UP A LIST OF NUMBERS ON THE FLY! You can use a spreadsheet if you want to get serious about formulas. I don’t.

There are some very helpful answers here, but man. I ask a simple question about whether a feature I use exists in Libre Office - one that you don’t have to use in Word if you don’t want to, in fact it’s not even there by default! - and people feel the need to tell me it’s all wrong.

Why?!

When you ask a question here, you express interest in the feature. And this starts a discussion. It allows others to express their opinions. It’s not your thread, it’s just a thread you started. Everyone is welcome to participate.

And no, LibreOffice is not named so “because it’s an alternative to MS Office” - its name follows OpenOffice.org, which itself follows the name of StarOffice from 1994. Also, it never claimed to be just a free substitute of MS Office - it always built on some different architectural principles. MS Word isn’t a “gold standard” - it does so many things in a way detrimental for the good structured electronic documents. The need to support some its features is a bane arising from people’s habits, not from goodness of those features. The “alternative” would be appropriate term not in a sense of “here’s a free Word”, but “here’s an alternative way of working with documents”.

1 Like

And I have to repeat: in macOS, you can simply do the same thing using their Calculator program!

Cut the list of numbers

And when the discussion turns into to people telling me a feature I like is wrong, followed by some patronizing joker saying it’s pure coincidence that a suite of programs with the same functions as the one in MS’ suite just happens to have the word “office” in its title too… I look for the button to turn off notifications and go find something better to do with my time.

You are never required to continue participating in the discussion. It looks like you feel obliged to answer every post here; please be advised that no, you are not.

By the way, being able to do something in a “Calculator” program has nothing to do with a request to do the same in Writer program.

It does not use Calc expression syntax but the special syntax of formula fields in Writer. The syntax is described in Formula in the online help.

Don’t remember when I last used formulas in TextTable or possibly in TextField. In the rare cases when I did it many years ago it wasn’t of much use.
Anyway: If a tool working with formulas supports trigonometric functions, it must (imo) also support PI() and…
Is this strange list dictated by MS?
This way “compatibility” isn’t an advantage, but a plague.
The sloppy design of Word as a “standalone” should not be carried through everywhere,

Writer formula syntax uses the constant pi instead of a function call.

I don’t know the origin of the Writer formula syntax, but it is there since the beginning. So if any relation to Word exists, then to the binary versions of Word. I think nobody would object, if Writer becomes able to use the OpenDocumentFormat Formula syntax as used in Calc. You need “only” developers to implement it. For discussions around this problems see e.g. tdf#137764.

Thanks again. I’m obviously even less informed about formulas in Writer than I thought.

The case of separation of operands by paragraph breaks can’t be taken serious, imo.
To calculate expressions each given as a separate selected TextPortion, and to replace them with the results is rather simple in LibO, because it’s “monolithic”, and can use Calc functionality in the background.
A solution working this way depends on user (custom) code, however. Basic code demonstrating how this works is included with the attached example.
disask114902_textCalculator.odt (38.9 KB)
Enhanced:
disask114902_textCalculator2.odt (73.9 KB)