Cell value displays '#VALUE!'

Hi @aleksandra_budnik!

Cell B3 in a handsont table has formula ‘=C3/D3’.
Since values in cells C3 and D3 are 0, the value of cell B3 becomes #VALUE!

I want to avert that. Please suggest something.

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

Also, I’m unable to retrieve the value from a cell which has formula.
I’ve tried using the hack given in issue #2645
But, my hot3.plugin returns undefined.

Please refer to the following fiddle: http://jsfiddle.net/RishabhRanjanKesarwani/k4cdp9b3/164/

Hi @rishabhbhs

we cannot divide something by 0. MS Excel also doesn’t allow to dive by zero and returns an error.

Here http://jsfiddle.net/m3fh6c5s/21/ is an example of copying a formula instead of its value.

The code is not working. Please check.
And I want to get the computed value instead of the formula.

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?