I have a salary table which has about 28 numeric columns of different types of allowance that I am trying to group into about 5 column - for example, Fringe Benefits Total = Accident Allowance + Mobile Allowance. The challenge I have is that many of these cells are empty. I could use trigger formulas or column transform to make empty values 0, but I would like to leave them as I got them from the HR system export.
Now I need some clean way to coerce None to 0 in all my formulas so that I don’t get this error -
TypeError : unsupported operand type(s) for +: 'float' and 'NoneType'
A `TypeError` is usually caused by trying
to combine two incompatible types of objects,
by calling a function with the wrong type of object,
or by trying to do an operation not allowed on a given type of object.
You tried to add two incompatible types of objects:
a number (`float`) and a variable equal to `None` (`NoneType`).
I have already referred to this post and it is not helpful for my current situation #TypeError - How to resolve errors in a formula column due to empty cells - Showcase - Grist Creators
Thank you very jarek. After seeing your post, I recalled having seen such a function, but when I was searching for it, I could not find it.
2 suggestions for Grist team to consider:
Please add the python error we get with the link to the article as a solution, so that when someone searches using the python type error, they will be pointed to this article
Please consider applying N function automatically if a numeric field is empty. Being a programmer and a DB guy, I know the default puristic handling of None/Null. But given that Grist is targeted towards the average Excel user, please mimic the simplicity and the sensible default of Excel considering empty cells as 0 in numeric calculations.