Skip to main content
1-Visitor
December 9, 2014
Solved

Extraction and sum of values in an array

  • December 9, 2014
  • 5 replies
  • 1882 views

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

Best answer by Werner_E

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
December 9, 2014

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




BPP1-VisitorAuthor
1-Visitor
December 10, 2014

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.

Werner_E
Werner_E25-Diamond IAnswer
25-Diamond I
December 10, 2014

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

BPP1-VisitorAuthor
1-Visitor
December 10, 2014

So it possible enter the arguments of the two ways.

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