Ask Your Question
0

Calc: Neater way to ignore errors

asked 2020-10-16 00:37:03 +0200

vxky33x0egwnf4 gravatar image

Let's consider any (potentially lengthy) function that can produce an error. For discussion's sake, I'll use =1/0. I can ignore the resulting error by using the following formula:

=IF(ISERROR(1/0),"",(1/0))

As you can see, the function (e.g. 1/0) is typed twice. Is there a neater way to do this?

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
0

answered 2020-10-16 12:20:00 +0200

Opaque gravatar image

updated 2020-10-16 12:22:14 +0200

Hello,

check function IFERROR(): In your example it would read: =IFERROR(1/0;"")

See also: LibreOffice Help - IFERROR

Hope that helps.

edit flag offensive delete link more

Comments

Perfect! Thanks @Opaque.

vxky33x0egwnf4 gravatar imagevxky33x0egwnf4 ( 2020-10-16 15:52:46 +0200 )edit
0

answered 2020-10-16 11:19:18 +0200

Pansmanser gravatar image

What result do you want when the formula fails? You can work around the error by writing the formula into a macro function. Of course you have to be able to recognise that this is an error result. eg

function myfunction(i) as double
on error goto oops
myfunction = 1.0/i
exit function
oops:
myfunction=999.999
end function
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2020-10-16 00:37:03 +0200

Seen: 30 times

Last updated: Oct 16