cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

We are working to address an issue with subscription email notifications. In the meantime, be sure to check your favorite boards for new topics.

How to use "on error" in my function.

mzarrabi
12-Amethyst

How to use "on error" in my function.

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.

1 ACCEPTED SOLUTION

Accepted Solutions
MJG
18-Opal
18-Opal
(To:mzarrabi)

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

Capture.PNG

View solution in original post

6 REPLIES 6
RichardJ
19-Tanzanite
(To:mzarrabi)

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.

mzarrabi
12-Amethyst
(To:RichardJ)

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,

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.

 

mzarrabi
12-Amethyst
(To:Werner_E)

you are right, but if I use "return", the function gives me the last value of y. In fact, I'd like to see previous values of y also.

MJG
18-Opal
18-Opal
(To:mzarrabi)

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

Capture.PNG

mzarrabi
12-Amethyst
(To:MJG)

Thank you very much MjG. It works well now.

Top Tags