How to avoid errors in formula

Hi,
i’m struggling to find a way to avoid error sign in formula.
my formula is calculating precentage so there i divide one column with another.
i’m trying to find a solution that will not show the red error sign everytime the column is equal to 0.
But it seems that monday.com formula read the formula from the end. so any if i give doesnt help.

Here is my formula :
if({This Year Budget}>0,
ROUND(({Balance}/{This Year Budget})*100,0),
“”)

Hi Nytai,

In monday, the 2 scenarios of the if function are evaluated first then the condition :roll_eyes: which is counter-intuitive. So your formula throws an error when you divide by 0 or by an empty {This Year Budget} column.

Try

IF(AND({This Year Budget}<>"",{This Year Budget}>0),ROUND({Balance}/MAX({This Year Budget},1)*100,0),"")

First, instead of dividing by {This Year Budget}, I divide by the higher value between {This Year Budget} and 1 (you could change 1 for whatever value that serves you better).

So if {This Year Budget} is 0 or empty, it doesn’t generate an error because it divides by 1. This is of course theoratical because the condition checks if both {This Year Budget} is not empty and not zero, so in fact the calc is never run in these 2 cases.

It works, but it is overly complicated.


This is a good example of why you might want to look a 3rd-party app like the Advanced Formula Booster which among many other advantages allows you to write to any column (you don’t need to use the Formula column anymore) and to use several instructions to write your formulas. In this case, you could write a formula as shown below. I could have done it using a single instruction but wanted to illustrate that you can split your formulas in several easy to troubleshoot instructions so you don’t get the infamous red icon without knowing where the problem lies…

2023-11-26_14-03-57