Skip to main content
18-Opal
November 13, 2022
Solved

SELECT DIFFERENT VALUES IN SUMMATION FUNCTION

  • November 13, 2022
  • 1 reply
  • 780 views

I am tring to set the starting value of the summation as below. Prime 8 file attached.

Want to be able to set k=r or k=0.

ppal_0-1668375618343.png

 

Best answer by Werner_E

Try to avoid using all uppercase letters in your subject as this is considered loud shouting/screaming and there is no reason to do so here.

 

Are you looking for a function with the argument specifying that starting value of k or do you just want to set a worksheet variable and want the calculation be done dependent on this variable.

In the latter case you may simply define a variable start to be either 0 or 1 and setup the sum to start with k=r*start.

Furthermore its not necessary to use any loop! Your for-loops just returns the last result (for j = count) and discards all the previous ones. So you may simply use count in your sum instead or r.

Werner_E_2-1668381356104.png  Werner_E_3-1668381379880.png

 

EDIT: And here is the version with a function (as before the argument "st" is either 0 or 1):

Werner_E_4-1668381683921.png

 

 

Additional remark/question:

Why do you setup these as functions in t? None of them is dependent on t!!! The result is the same vector no matter which function argument you provide when you call these functions. So they could as well be variables instead of functions.

Werner_E_5-1668382022514.png

 

 

1 reply

Werner_E25-Diamond IAnswer
25-Diamond I
November 13, 2022

Try to avoid using all uppercase letters in your subject as this is considered loud shouting/screaming and there is no reason to do so here.

 

Are you looking for a function with the argument specifying that starting value of k or do you just want to set a worksheet variable and want the calculation be done dependent on this variable.

In the latter case you may simply define a variable start to be either 0 or 1 and setup the sum to start with k=r*start.

Furthermore its not necessary to use any loop! Your for-loops just returns the last result (for j = count) and discards all the previous ones. So you may simply use count in your sum instead or r.

Werner_E_2-1668381356104.png  Werner_E_3-1668381379880.png

 

EDIT: And here is the version with a function (as before the argument "st" is either 0 or 1):

Werner_E_4-1668381683921.png

 

 

Additional remark/question:

Why do you setup these as functions in t? None of them is dependent on t!!! The result is the same vector no matter which function argument you provide when you call these functions. So they could as well be variables instead of functions.

Werner_E_5-1668382022514.png