Possibility to calculate numbers?



  • Hello,

    I have a file which cointains only 1 number in each line, like this:

    5,30
    6,90
    7,50
    12,8
    1,11
    0,50

    Is there any function or script in Notepad++ to get the sum (34,11) of all this lines?
    This would be very helpful. I know, that it is easy to copy it and paste it in Excel and see the sum immediately, but for me it would be very helpful to see it directly in Notepad++.
    Do you have any idea how to get this?
    If necessary I could of course change the decimal sign from , to . before calculating the sum.



  • @Jürgen-Greil

    nothing builtin - but there is a math plugin available, check plugin manager.
    Maybe it can do what you want or install a scripting language plugin like python or lua script
    and write a script doing it.

    Cheers
    Claudia



  • One other way is to use TextFX.
    My version of Notepad++ has under TextFx Tools an “Add up numbers” option.

    For the block:
    5.30
    6.90
    7.50
    12.8
    1.11
    0.501
    TextFX prints the message “Sum=34.1110”



  • Does anyone know how to get TextFX Tools’s feature “Add up numbers” in a current version of Notepad++?
    https://stackoverflow.com/questions/55197040/add-a-value-and-sum-it-up-using-notepad is quite complicated.



  • As a quite feasible workaround, I mark columns in Notepad++ via ALT+DragAndDrop and then copy & paste numbers to https://planetcalc.com/8183/ respectively times to https://rechneronline.de/add-time/multi.php for summing them up. MS Excel / LibreOffice Calc are worse as they contain many pitfalls when exceeding 24 hours.

    Still, I’d prefer to have the feature of the TextFX plugin as it is more convenient and I do not send the numbers into the Internet.



  • @georg-d ,

    Actually, the process you linked to in SO is quite simple, and is the best solution: 1) install plugin, 2) copy/paste/save from the SO answer, 3) run the script from the menu. This is only slightly more complicated than 1) Install TextFX, 2) run the summation from the menu.

    Further, you are not accurate about TextFX not working with modern Notepad++: it still works for the purpose you just described, even as late as v8.1.5 (the most recent release as of Sep 2021) – you just have to use the 32bit Notepad++, use Plugins Admin to install TextFX; et voila, you have the 2014 method of summing numbers again.



  • Sorry, I forgot my screenshot and debug info, which I meant to include above as evidence of my claim:

    7b483fc1-9ba8-4a7e-a417-15937bccd915-image.png

    Notepad++ v8.1.5   (32-bit)
    Build time : Sep 26 2021 - 15:15:32
    Path : C:\usr\local\apps\npp\npp.8.1.5.portable\notepad++.exe
    Command Line : 
    Admin mode : OFF
    Local Conf mode : ON
    Cloud Config : OFF
    OS Name : Windows 10 Enterprise (64-bit) 
    OS Version : 2009
    OS Build : 19042.1237
    Current ANSI codepage : 1252
    Plugins : mimeTools.dll NppConverter.dll NppExport.dll NppTextFX.dll 
    

Log in to reply