Cell value displays '#VALUE!'

And how to update the columnSummary using updateSettings?

My bad!. The resources were old. Here http://jsfiddle.net/j3bmo9hv/ is an updated example.

But sorry, I did not understand that correctly. To get a value you can ask for the getData (table) or getDataAtCell (for a cell) method.

Unfortunately, the columnSummary cannot be updated via updateSettings method. There is a bug reported for this scenario at https://github.com/handsontable/handsontable/issues/3597

Does this mean that I will have to destroy the existing HOT and create HOT again for modified columnSummary?
Or is there any other way to achieve that?

If I’ll use getDataAtCell for a cell which has a formula, I’ll get the formula in return. I want the computed value from that formula.

Then you can try the getSourceDataAtCell. Is that what you are looking for?

Yes, the column summary is a little bit buggy so you may prefer to destroy the table and recreate it.

I’ll try it tomorrow and let you know of the results.

Okay. Thanks!

Great. I keep my fingers crossed.

It returns the formula used in the cell.
For example, if cell (0,0) = ‘=SUM(B1:D1)’
Then hot.getSourceDataAtCell(0, 0) returns ‘=SUM(B1:D1)’ and not the sum of values in cells B1 to D1

Hi @rishabhbhs

Can I ask you to share an example where you describe what exactly you would like to get?
It looks like I might have missed the context.

I think I was misled.
Function getDataAtCell returns the value present on the cell.
I was under the impression that the function returns the formula in the cell. I was wrong.

Thanks.

Ok. That is fine. Great to know that you have found the method that you were looking for.

Hi @aleksandra_budnik!

Refer to the following fiddle:
http://jsfiddle.net/RishabhRanjanKesarwani/k4cdp9b3/178/

I have put an IF for cell (2, 1). But it is not working. Please help me how can I use IF

At the 2, 1 we have

=IF(D3=0, 0, C3/D3)

Where D3 is 0, C3 is 0. You should get 0 as a result. It looks like this formula has a bug.

Yeah! Please check.

Hi @rishabhbhs

I have simplified the code at http://jsfiddle.net/y7wp6qvm/

The formula results in a bug as the if false value returns a bug (we can’t divide by zero). If you type there anything else the formula works.

Hot’s formulas IF() has always had this division by 0 problem. It always evaluates both possible results from the IF(), which is crazy. I reported it several years ago, but cannot find my post. It seems no one addressed it.

The only workaround is that you must nest another “redundant” IF() into the divisor of all formulas which use IF() to divide. Something like:

=IF(D3 = 0, 0, C3 / IF(D3 = 0, 1, D3))

I leave you/@rishabhbhs to examine and see why this will actually always produce the correct answer even though it looks like it might not…

I was also looking for this post. I knew that I saw it somewhere.
As it makes sense it can produce unnecessary issues. I have reported it to our board to never lose it again.

I’m just not sure about the title of the issue. Would that be ok https://github.com/handsontable/handsontable/issues/5272?

I think maybe the title is better than the example.

It’s not about “recalculating when zero”. It’s about “an IF() must never evaluate both the true & false results, because for example that could lead to a division by zero error from the route which the IF() will not follow. It must evaluate the condition first, and only then decide which single one of the two result to evaluate.”. But as you see fit.

BTW, I found If Formula not working in RuleJS, but that’s not the one where I suggested to someone the nested-IF workaround.

Thank you @jon
I’ve quoted you

1 Like

Thank you @jon!
It is easy to understand that the formula will work.