[Solved] If formula returns error show empty cell

Discuss the spreadsheet application
Locked
Bushido222
Posts: 2
Joined: Wed Feb 19, 2025 3:07 am

[Solved] If formula returns error show empty cell

Post by Bushido222 »

Hello Group,

First time here.

I'd like to write a formula such that if the result is an "error", the cell would be left blank. This situation arose when skipping lines in a worksheet but copying a formula to an entire column, thereby having the error (DIV-something) message appearing in every other row.

Many thanks
open office 3.1 windows 11
User avatar
robleyd
Moderator
Posts: 5504
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia

Re: If "x" then leave cell blank

Post by robleyd »

The ISERROR() function is probably what you are looking for. Something like

Code: Select all

=IF ( ISERROR(yourformula) ;"" ;yourformula )
Slackware 15 (current) 64 bit
Apache OpenOffice 4.1.16
LibreOffice 26.2.3.2; SlackBuild for 26.2.3 by Eric Hameleers
---------------
I hate this damn computer, I wish that I could sell it.
It won't do what I want it to, Only what I tell it.
User avatar
Zizi64
Volunteer
Posts: 11505
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: If "formula returns error" then leave cell blank

Post by Zizi64 »

A cell containing a FORMULA, will not (can not) be really blank. It will be visually blank with an empty string content.

When you use the function ISBLANK() in an another cell (referenced to the cell containing the formula) the result always will FALSE.
Tibor Kovacs, Hungary; LO7.5.8/25.8.5.2 /Win7-10-11 x64Prof.
PortableApps: LO3.3.0-25.8.5.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Bushido222
Posts: 2
Joined: Wed Feb 19, 2025 3:07 am

Re: [Solved] If formula returns error show empty cell

Post by Bushido222 »

Thank you both!

Not sure I've got it yet, but it's not the end of the world.
open office 3.1 windows 11
User avatar
Lupp
Volunteer
Posts: 3756
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany

Re: [Solved] If formula returns error show empty cell

Post by Lupp »

LibreOffice is a still actively maintained branch of the OpenSource OO.o origin. It supports all the features you may be used to, but is developed beyond that.
Concerning this topic. It has functions IFERROR() and IFNA() which help to simplify the solution suggested by @robleyd to

Code: Select all

=IFERROR(yourformula); "")
For the special case that only the error message "#N/A" shall be treated (while other errors should be shown) there would be

Code: Select all

=IFNA(yourformula); "")
If no error occurred, both formulas would return the result of yourformula.
This is mostly advanatageous if yourformula is complicated and/or needs to do a lot of calculations in the backround. Array-formulas are sometimes of that kind.
On Windows 10: LibreOffice 25.8.4 and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
Locked