XPB
XPB

Reputation: 23

In EmEditor: How to sum up values from two column's cell (in the same row) and store the results in third column?

I have a pipe separated file:
Col1| Col2| Col3
12 | 10 |
54 | 17 |

How I can get in the sum ( 22 & 71 ) in the Col3 ? Is there a build-in Function for this kind of operation ?

Upvotes: 2

Views: 814

Answers (1)

Yutaka
Yutaka

Reputation: 1806

After opening your CSV (or pipe-separated) file, select the Column 3 by clicking the Column 3 headings, press Ctrl+H to bring up the Replace dialog box, click the Advanced button, click the Reset button to make sure all options in the Advanced dialog box are default, and click OK.

In the Replace dialog box, enter:

Find: .*

Replace with: \J Number( cell( -1 ) ) + Number( cell( -2 ) )

Make sure the In the Selection Only and Regular Expressions options are set.

Click Replace All.

EmEditor - Sum values in columns

Notes: If you need to deal with decimal numbers, use: \J parseFloat( cell( -1 ) ) + parseFloat( cell( -2 ) ) instead for the Replace with expression.

References: http://www.emeditor.org/en/howto_search_replacement_expression_syntax.html

Upvotes: 2

Related Questions