Skip to main content
1-Visitor
Dec 9, 2014 8:33 PM UTC
Solved

Extraction and sum of values in an array

Hello everyone

As I can extract values from different columns of a matrix and get the total sum. Attached is a sample sheet with what I do.

Thanks in advance

Werner_E
Werner_EAnswer
25-Diamond I
Dec 10, 2014 10:39 AM UTC

Here you are.

If you don't like to use the vector notation when you provide the arguments, you may use the stack command where you can edit the arguments more convenient.

1.png

5 replies

Werner_E
25-Diamond I
Dec 9, 2014 11:46 PM UTC

It would be easy to write a function for your yellow expressions, but concerning your green expressions you demand too much for at least two reasons:

1.png

1) A user defined function can't have a variable number of arguments. You have to decide whether RESULT() should have two or just one argument.

2) Life would be much easier if we could agree on that the second function argument always indicates the columns in the matrix and not one time the columns and the other time one additional row. Furhermore - how should RESULT() know in the screenshot above that you mean just the firrst column?

Of course it would be possible to implement RESULT() in such a way that in case the second argument is not a valid column number but a string that it meant as an additional row indicator and column(s) should default to 1 in the special case. But I would strongly advise against that kind of (very) special rule.

So something like the following is easy to implement, but your green examples -- harder (2nd argument is row, too) up to impossibe (function with either one or more arguments).

2.png




Translate
BPP1-VisitorAuthor
1-Visitor
Dec 10, 2014 1:25 AM UTC

The expressions in green, were just a curiosity. Do not know why but I came to mind if it was possible to introduce the variables that way.

It was my mistake to introduce this curiosity in the question . Concerning the terms in yellow, would greatly appreciate if you could help me with these expressions, because for my is difficult create a routine for that.

Translate
Werner_E
Werner_E25-Diamond IAnswer
25-Diamond I
Dec 10, 2014 10:39 AM UTC

Here you are.

If you don't like to use the vector notation when you provide the arguments, you may use the stack command where you can edit the arguments more convenient.

1.png

Translate
BPP1-VisitorAuthor
1-Visitor
Dec 10, 2014 12:35 PM UTC

So it possible enter the arguments of the two ways.

Thank you very much Werner and also to Stuart for your suggestion.

Translate