<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Anything to add up selected numbers? (or plugin suggestion)]]></title><description><![CDATA[<p dir="auto">Let’s say I have either of these two (attahced) sets of numbers in my text file<br />
<img src="/assets/uploads/files/1628858927348-numbers01.jpg" alt="numbers01.jpg" class=" img-fluid img-markdown" /> <img src="/assets/uploads/files/1628858927264-numbers-02.jpg" alt="numbers 02.jpg" class=" img-fluid img-markdown" /><br />
There’s a site out there, <a href="http://calculla.com" rel="nofollow ugc">calculla.com</a>, where you can paste in numbers like this, and it will add them up and give you a total sum. That’s whether the numbers are vertical or horizontal. Considers spaces between numbers, and/or new lines, to be delimiters which separates each number.<br />
Is there any plugin out there that will do anything like that?<br />
I know of another text editor (one which stinks in every other respect compared to NPP), but it does have a function to add up selected numbers.<br />
Anyone know of a plugin, or a way to do this?<br />
Thanks!</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/21653/anything-to-add-up-selected-numbers-or-plugin-suggestion</link><generator>RSS for Node</generator><lastBuildDate>Mon, 10 Aug 2026 02:01:58 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/21653.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 13 Aug 2021 12:56:37 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Anything to add up selected numbers? (or plugin suggestion) on Fri, 01 Apr 2022 15:22:04 GMT]]></title><description><![CDATA[<p dir="auto">This was turned into a real issue <a href="https://github.com/notepad-plus-plus/notepad-plus-plus/issues/11461" rel="nofollow ugc">HERE</a>.</p>
<p dir="auto">I posted a PythonScript solution there.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/75633</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/75633</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Fri, 01 Apr 2022 15:22:04 GMT</pubDate></item><item><title><![CDATA[Reply to Anything to add up selected numbers? (or plugin suggestion) on Wed, 29 Sep 2021 15:30:43 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/georg-d" aria-label="Profile: georg-d">@<bdi>georg-d</bdi></a> said in <a href="/post/70136">Anything to add up selected numbers? (or plugin suggestion)</a>:</p>
<blockquote>
<p dir="auto">Notepad++ version 6.6.7 (of 2014) summing up numbers was easily possible with plugin TextFX Tools -&gt; Add up numbers:</p>
</blockquote>
<p dir="auto">And it is still as easily possible with v8.1.5 32bit in September 2021.  <a href="https://community.notepad-plus-plus.org/post/70140">see more</a></p>
]]></description><link>https://community.notepad-plus-plus.org/post/70141</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/70141</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Wed, 29 Sep 2021 15:30:43 GMT</pubDate></item><item><title><![CDATA[Reply to Anything to add up selected numbers? (or plugin suggestion) on Wed, 29 Sep 2021 15:11:47 GMT]]></title><description><![CDATA[<p dir="auto">FYI, <a href="https://community.notepad-plus-plus.org/topic/14554/possibility-to-calculate-numbers/4">https://community.notepad-plus-plus.org/topic/14554/possibility-to-calculate-numbers/4</a> is related</p>
]]></description><link>https://community.notepad-plus-plus.org/post/70138</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/70138</guid><dc:creator><![CDATA[georg-d]]></dc:creator><pubDate>Wed, 29 Sep 2021 15:11:47 GMT</pubDate></item><item><title><![CDATA[Reply to Anything to add up selected numbers? (or plugin suggestion) on Wed, 29 Sep 2021 15:06:45 GMT]]></title><description><![CDATA[<p dir="auto">This is an answer as well as a bump for the question: In Notepad++ version 6.6.7 (of 2014) summing up numbers was easily possible with plugin TextFX Tools -&gt; Add up numbers:<br />
<img src="/assets/uploads/files/1632927902119-notepad-v6.6.7-of-2014-with-plugin-textfx-tools-add-up-numbers.png" alt="notepad++ v6.6.7 of 2014 with plugin TextFX Tools - Add up numbers.png" class=" img-fluid img-markdown" /><br />
I know that many features of TextFX made it into the core of Notepad++ but I do not find “add up numbers”. Any ideas where to find it?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/70136</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/70136</guid><dc:creator><![CDATA[georg-d]]></dc:creator><pubDate>Wed, 29 Sep 2021 15:06:45 GMT</pubDate></item><item><title><![CDATA[Reply to Anything to add up selected numbers? (or plugin suggestion) on Fri, 13 Aug 2021 19:08:11 GMT]]></title><description><![CDATA[<p dir="auto">Hello, <a class="plugin-mentions-user plugin-mentions-a" href="/user/chris-tanguay-0" aria-label="Profile: Chris-Tanguay-0">@<bdi>Chris-Tanguay-0</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: peterjones">@<bdi>peterjones</bdi></a> and <strong>All</strong>,</p>
<p dir="auto">An other solution, <strong>less</strong> elegant of course, would be to use, <strong>first</strong>, a <strong>regex</strong> S/R, then the <strong>calc.exe</strong> utility !</p>
<p dir="auto">For instance, given the <em>INPUT</em> text :</p>
<pre><code class="language-diff">Any_text3 14 15
9 27
2 7 18 28
18 28any_other_text
</code></pre>
<ul>
<li>
<p dir="auto">Then the following <strong>regex</strong> S/R :</p>
<ul>
<li>
<p dir="auto">SEARCH <strong><code>(\d+)\s*(?=(\d+)|.|\z)</code></strong></p>
</li>
<li>
<p dir="auto">REPLACE <strong><code>$1?2+:=</code></strong></p>
</li>
</ul>
</li>
</ul>
<p dir="auto">Would be changed as the <em>OUTPUT</em> text, below :</p>
<pre><code class="language-diff">Any_text3+14+15+9+27+2+7+18+28+18+28=any_other_text
</code></pre>
<ul>
<li>
<p dir="auto">Then, select the <strong>numeric</strong> part <strong><code>3+14+15+9+27+2+7+18+28+18+28=</code></strong></p>
</li>
<li>
<p dir="auto">Hit the <strong><code>Ctrl + C</code></strong> shortcut</p>
</li>
<li>
<p dir="auto">Hit the <strong><code>Win</code></strong> Key  + <strong><code>R</code></strong> shortcut</p>
</li>
<li>
<p dir="auto">Type in <strong><code>calc</code></strong> and valid with  <strong><code>Enter</code></strong></p>
</li>
<li>
<p dir="auto">Hit the <strong><code>Ctrl + V</code></strong> shortcut</p>
</li>
</ul>
<p dir="auto">=&gt; <strong>Result</strong> = <strong><code>169</code></strong></p>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
<p dir="auto">And the text, with <strong>tabulation</strong> chars, between the <strong>two</strong> columns :</p>
<pre><code class="language-diff">10	8
6	10
1	3
4	3
</code></pre>
<p dir="auto">Would give :</p>
<pre><code class="language-diff">10+8+6+10+1+3+4+3=
</code></pre>
<p dir="auto">=&gt; <strong>Result</strong> = <strong><code>45</code></strong></p>
]]></description><link>https://community.notepad-plus-plus.org/post/68832</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/68832</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Fri, 13 Aug 2021 19:08:11 GMT</pubDate></item><item><title><![CDATA[Reply to Anything to add up selected numbers? (or plugin suggestion) on Fri, 13 Aug 2021 13:44:53 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/chris-tanguay-0" aria-label="Profile: Chris-Tanguay-0">@<bdi>Chris-Tanguay-0</bdi></a></p>
<p dir="auto">In 32-bit Notepad++, there is a plugin called <a href="https://sourceforge.net/projects/nppcalc/" rel="nofollow ugc">NppCalc</a>, but AFAICT, it requires an actual expression rather than just adding any numbers in the document.</p>
<p dir="auto">There is a newer plugin I’ve never seen before called Expression Calculator (listed in both 32bit and 64bit NPP), but I know nothing about that one, and the homepage it directs you to says nothing about a Notepad++ plugin… There, I was able to find the <a href="https://github.com/notepad-plus-plus/nppPluginList/blob/e59f9502daeca18a90551bcc4754c8b608990390/src/pl.x64.json#L816-L825" rel="nofollow ugc">download link</a> and thus extrapolate to the <a href="https://github.com/PlanetCNC/PlanetCNCNpp" rel="nofollow ugc">github home for Expression Calculator</a>, which shows that it appears to be very similar to the NppCalc, and thus probably not exactly what you want.</p>
<p dir="auto">If I wanted to add up all the numbers in a document, I would pull out the PythonScript plugin and write a script to do it, something like the script shown at the end of this post.  (It contains the instructions for how to install PythonScript, how to add this script to PythonScript and run it, and how to add a keyboard shortcut if desired)</p>
<p dir="auto">That script will take the input</p>
<pre><code>3 14 15
9 27
2 7 18 28
18 28
</code></pre>
<p dir="auto">and will become</p>
<pre><code>3 14 15
9 27
2 7 18 28
18 28

====TOTAL=169====
</code></pre>
<p dir="auto">----------</p>
<pre><code># encoding=utf-8
"""in response to https://community.notepad-plus-plus.org/topic/21653/

Add up all the numerical tokens in a file, separated by whitespace.
It will append the total to the end of file, like

    =====TOTAL=###=====

If you don't want just unsigned integers, you'll have to change the search
regular expression and change the code in the function to not force
integer arithmetic.

----

this uses the "add_1" style search in Notepad++

INSTRUCTIONS:
1. Install PythonScript
   * Plugins &gt; Plugins Admin
   * Click ☑ PythonScript checkbox until checked
   * click INSTALL
   * restart Notepad++ as necessary
2. Create new PythonScript script
   * Plugins &gt; PythonScript &gt; New Script
   * Give it a reasonable name, like AddAllInts.py
   * Paste in the code from this black box
   * Save
3. Switch to the document where you want to search/replace
4. Plugins &gt; PythonScript &gt; Scripts &gt; AddAllInts

To assign a keyboard shortcut:
1. Plugins &gt; PythonScript &gt; Configuration
2. In the User Scripts, click on AddAllInts.py
3. Click the left ADD button (above Menu Items)
    * This adds "AddAllInts" to the main Plugins &gt; PythonScript menu, rather
      than requiring you to dig down into the Scripts submenu
4. Exit Notepad++ and restart
    * This is required for ShortcutMapper to be able to see the new entry
      in the PythonScript menu
5. Settings &gt; ShortcutMapper &gt; Plugin Commands
6. Filter by AddAllInts
7. Click on AddAllInts, then click the MODIFY button and
    set the keyboard shortcut in the dialog

PythonScript has documentation in its Context-Sensitive Help
"""
from Npp import *

grand_total = 0

def add_int_to_total(m):
    global grand_total
    i = int(m.group())
    grand_total += i

editor.beginUndoAction()
editor.documentStart()
editor.research(r'\b\d+\b', add_int_to_total)
editor.documentEnd()
editor.addText("\n====TOTAL={}====\n".format(grand_total))
editor.endUndoAction()
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/68813</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/68813</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Fri, 13 Aug 2021 13:44:53 GMT</pubDate></item></channel></rss>