Hi.

I have a text field with several numbers separated by tabs. Something like this:

1 3 4 5

2 5 6 8

1 2 3 5

and I want to get the sum of each column separated by tabs aswell:

4 10 13 18

Considering that:

- I don´t know in advanced the number of columns or the number of lines in the field

- every line will have the same number of values (4 values in the example)

...is it possible to get the result I need using a calculation (not an script)?

Thank you.

Try

// SumColumns ( input )

Case (

IsEmpty ( $curRow ) or $colCounter = ValueCount ( $curRow ) ;

Let ( [

$rowCounter = $rowCounter + 1 ;

$curRow = Substitute ( GetValue ( input ; $rowCounter ) ; Char(9) ; ¶ ) ;

$colCounter = ""

] ;

""

) ;

Let ( [

$colCounter = $colCounter + 1 ;

curVal = GetValue ( $curRow ; $colCounter ) ;

$res =

List (

Let ( ~l = LeftValues ( $res ; $colCounter - 1 ) ; Left ( ~l ; Length ( ~l ) - 1 ) ) ;

GetValue ( $res ; $colCounter ) + curVal ;

RightValues ( $res ; ValueCount ( $res ) - $colCounter )

)

] ;

""

)

)

&

Case (

$rowCounter > ValueCount ( input ) ;

Let ( [

res = Substitute ( $res ; Char(13) ; Char(9) ) ;

$res = "" ;

$curRow = "" ;

$rowCounter = ""

] ;

res

) ;

SumColumns ( input )

)