Skip to main content
1-Visitor
November 10, 2017
Solved

How to use "on error" in my function.

  • November 10, 2017
  • 6 replies
  • 3554 views

Hi everybody. I have attached a picture of my function. Does anyone know how to find a way that the while loop goes to the next loop whenever there is an error in the D_M function?  My current way of coding does not work and I cannot find the reason.

Best answer by MJG

I believe the following two options would give you what you want:

Capture.PNG

6 replies

19-Tanzanite
November 10, 2017

The format for "on error" is "x  on error y". It evaluates y, and if that gives an error, it returns x instead. That is not what you have. Note that you cannot just type "on error" into a placeholder. You must enter it from the programming toolbar.

mzarrabi1-VisitorAuthor
1-Visitor
November 10, 2017

Dear Richard,

Thank you for your response. Now, I understand what was the problem. I modified it a little bit. Now there is another problem.  When yj equals to "x.calculations" the function stops as I want, but it does not show "x.calculation" as the last answer.

Best,

25-Diamond I
November 10, 2017

use

 

return "x.calculation"

 

instead of

 

"x.calculation"

break

 

Note, that "return" is a command liek "if" or "on error" and you have to chose it from the toolbar and can't simply type it in.