Calculate command as in Word

In MS Word you can highlight a list of numbers separated by paragraph returns, then issue the Calculate command and it’ll add them up and put the result in the clipboard.

You can also do other arithmetic: put numbers in parenthesis to subtract them from the list, use * to multiply, and / to divide.

I see the command in the Tools menu (maybe it imported it from Word?), but it doesn’t seem to do anything.

Does this command exist in LibreOffice? You can just copy the numbers into the macOS Calculator and do the same thing, so if not it’s not the end of the world, but it is convenient - especially during tax season.

TIA

Calculating and Pasting the Result of a Formula in a Text Document

1 Like

Thanks. That’s if it contains a formula, and I don’t use those normally.

But as I said, I figured out that you can just paste it into the macOS Calculator, so it’s not a big deal.

I can’t find the option you are talking about in Word/Win11.

Haha, nor could I for while. In Word 2010, it was carefully hidden away, so I added it to the QuickAccess toolbar. Note the All commands

1 Like

I can’t find it in
Microsoft® Word para Microsoft 365 MSO (versión 2410 compilación 16.0.18129.20158) de 64 bits

To make it more fun :smile: , apparently they renamed it to Tools Calculate for Office 365
See Redirecting

1 Like

Yes, you have to add it to the menu. But am I right that the same thing doesn’t exist in Libre Office?

IMHO it is one of this features wich LibreOffice doesn’t need. MS is/was selling Word as a separate software, so it needed its own way for serial letters, a calculator etc.
.
LibreOffice is simply delivering Base and Calc for free, so you can use this tools. Always remember: Star-/Open-/LibreOffice was not designesd as a clone of MS-Office. You may replace it, but you will feel the difference. (The best time for transit was, when MS enforced ribbons to users. So one had to learn new stuff anyway…)

1 Like

I totally agree. With the already-existing features, it is trivial even in Writer, to press F2 then 2+5+46Enter, and have the result in a calculated field (which may be even used better, by defining document variables, and having calculations refresh on data change); or to have a table with numbers, and add a sum; or to use Calc. But having several paragraphs with numbers in a text document, select them, press some button, and have their sum in clipboard? That’s just crazy. This is a text document! Why do you think that easter eggs like this are better than e.g. Pinball in Word 97?

that kind of macro would do the trick :

Sub sum_selected_strings()
	GlobalScope.BasicLibraries.LoadLibrary("ScriptForge")
 
    For each s in  thisComponent.CurrentSelection
		nums = SF_String.ReplaceRegex( s.getString, "[^\d]+", " ")
		For each  n  in split(nums, " ")
	      	sum = sum + cint(n)
		Next
	Next

	msgbox "sum = "& sum
	
	' CopyToClipBoard(sum)
End sub

Copying to clipboard is a misery, e.g. How do you copy text to clipboard from macro? - #7 by george37809
(I guess the answer will be we don’t need clipboard copy :wink: )

The answer is: we DONT need ScriptForge!

def main(*_):
    doc =XSCRIPTCONTEXT.getDocument()
    xsum = 0
    for part in doc.CurrentSelection:
        xsum += sum(map(float, part.String.replace(',','.').split()))
    print(xsum)

Python interpreter and modules not working reliably :innocent:

Thanks @EarnestAI, I found it.

topic missed?!

It’s one you and Mikegagariski don’t need but that I use!

I’m not complaining, I’m just asking, for heaven’s sake.

Thanks so much, fpy, will give that a try.

Changing for another tool always requires a change of routine.

Have you considered thoroughly your workflow? You mention a list of paragraphs containing numbers. Are these paragraph a “meaningful” part of the document. By “meaningful”, I mean: are these paragraphs part of the normal reading flow? Do they bring something important to the argumentation?

  • If the answer is “no”, they are simply scratch annotations out of which you compute the total, the only significant data.
  • If the answer is “yes”, I doubt that the numbers are simply written down alone without any comment or explanation. In this case, you need a table and you’ll end up “naturally” either with a Calc table or the minimalistic Writer spreadsheet.

I share @Wanderer’s and @mikekaganski’s point of view. This is a personal routine which can be achieved differently. My 2-cent supplement: there are enough open bugs in LO, critical enough to impede users, that we don’t need to add “noise” features in a product demanding stability and reliability.

Featurism is a deadly plague in software. It costs a lot to integrate and maintain new features in an existing application without breaking it. When a feature is not vital, I prefer not to request it in favour of a reliable app.

Until now, you have not demonstrated which aspect of your routine is innovative and susceptible of a shared interest. To attract attention of developers, please provide an example document where your workflow proves superior to the suggested workarounds. So, share your ideas (in the form of an example and a semi-specification) so that convinced users would pressure developers. In FOSS, there is word “open”. Developers are also “open” to innovation and would be proud to be at least on par with commercial competition.

2 Likes

Dude. I asked whether this feature exists in the program. Why are you so aggressive?

I didn’t ask for anything to be implemented, and it’s not a noise feature to me, it’s one I’ve been using for almost 40 years. You also have no idea how or when I use it.

Exactly. So, please, provide an example case showing its usefulness. I am not aggressive, I only want to understand how it fits in a “standard” document. Clarify the relationship between paragraphs containing (only?) numbers and surrounding text. I don’t grasp the integration of numbers in a discourse. There must be at least an introduction to them, but what is their individual role when they’re isolated in their paragraph? Once I got the idea, I could suggest a way to achieve your goal, likely to be different from Word.

What you are looking may be present under a different process.