You are here: PSPad forum > English discussion forum > How to calculate the sum of all numbers in the editor?

How to calculate the sum of all numbers in the editor?

#1 How to calculate the sum of all numbers in the editor?

Posted by: maki | Date: 2017-11-28 11:42 | IP: IP Logged

How to calculate the sum of all numbers in the editor?

Example 1:

05,06,08,09,10,11,12,19,22,25,33,37,41,42,44,56,65,71,72,75

05+06+08= etc.

I can do this in the calculator but I want to do it faster in PSPad.
For multiple cell numbers (CSV format)

Example 2:
Multi Line:
1
2
10
45
67

1+2+10+45+67= etc.

Options: Reply | Quote | Up ^


#2 Re: How to calculate the sum of all numbers in the editor?

Posted by: pspad | Date: 2017-11-28 12:01 | IP: IP Logged

There is no line calculation, but PSPad contains Calculate Block function in the menu Tools.
Select lines, containing numbers and call Calculate block

For the first example, you need to transform line:¨
05,06,08,09,10,11,12,19,22,25,33,37,41,42,44,56,65,71,72,75
to
05+06+08+09+10+11+12+19+22+25+33+37+41+42+44+56+65+71+72+75

Select this line and put it into function Tools/Expression evaluator

Options: Reply | Quote | Up ^


#3 Re: How to calculate the sum of all numbers in the editor?

Posted by: Gabriel_ACE | Date: 2017-11-28 12:07 | IP: IP Logged

maki:
How to calculate the sum of all numbers in the editor?

Example 1:

05,06,08,09,10,11,12,19,22,25,33,37,41,42,44,56,65,71,72,75

05+06+08= etc.

I can do this in the calculator but I want to do it faster in PSPad.
For multiple cell numbers (CSV format)

Example 2:
Multi Line:
1
2
10
45
67

1+2+10+45+67= etc.

it is a text editor, not a excel hahahahaahahah grinning smiley

Options: Reply | Quote | Up ^


#4 Re: How to calculate the sum of all numbers in the editor?

Posted by: maki | Date: 2017-11-29 15:35 | IP: IP Logged

@Gabriel_ACE - No need to use Excel program to open and edit CSV files. I use a different the best text editor, which in its powerfull variety of options is created to open and edit CSV files.
For me, the editor not only needs to be the fastest, open the largest files with ease and ease of use, but have all the options that one will have. I have chosen one and honestly I am most satisfied with it.
Ps. Just have to remember that it is not free, but it is worth paying. But it is worth it!
I use PSPad only because it has an option:
Lines Manipulation ALT + I, join lines etc.

Edited 1 time(s). Last edit at 2017-11-29 15:35 by maki.

Options: Reply | Quote | Up ^


#5 Re: How to calculate the sum of all numbers in the editor?

Posted by: pspad | Date: 2017-11-29 16:55 | IP: IP Logged

Maki, have you read my answer? It works for column block too, if you have numbers in text

Options: Reply | Quote | Up ^


#6 Re: How to calculate the sum of all numbers in the editor?

Posted by: Andreas | Date: 2017-12-03 20:52 | IP: IP Logged

There is no editor which includes all things you can imagine. Thats why there are scripts so you can write your code to accomplish all things that you want.

Here the JS-Code to test in FF Devtools:

console.clear();

var
myCommaSeparatedInputString = '05,06,08,09,10,11,12,19,22,25,33,37,41,42,44,56,65,71,72,75',
mySumFromCommaSeparatedString = myCommaSeparatedInputString.split(',').reduce((pv, cv) => parseInt(pv) + parseInt(cv))
;

console.log(myCommaSeparatedInputString, mySumFromCommaSeparatedString);

Outputs:
21:40:08.983 Konsole wurde geleert. Scratchpad/2:1
21:40:08.984 05,06,08,09,10,11,12,19,22,25,33,37,41,42,44,56,65,71,72,75 663 Scratchpad/2:7:1

Options: Reply | Quote | Up ^


#7 Re: How to calculate the sum of all numbers in the editor?

Posted by: maki | Date: 2017-12-07 12:23 | IP: IP Logged

Does this script need to be edited for different numbers each time?
Can you create automatic actions?
Calculate the number of occurrences / Match of each number?
Calculate the number of repetitions of each number?

Options: Reply | Quote | Up ^


#8 Re: How to calculate the sum of all numbers in the editor?

Posted by: pspad | Date: 2017-12-07 14:11 | IP: IP Logged

maki:
Does this script need to be edited for different numbers each time?
Can you create automatic actions?
Calculate the number of occurrences / Match of each number?
Calculate the number of repetitions of each number?

No, script is independent of count of numbers
If you can, you can calculate anything in the script and write result in the box

Options: Reply | Quote | Up ^






Editor PSPad - freeware editor, © 2001 - 2024 Jan Fiala, Hosted by Webhosting TOJEONO.CZ, design by WebDesign PAY & SOFT, code Petr Dvořák, Privacy policy and GDPR