Formula for rows

Tags: #<Tag:0x00007fd2be20e3b8>

@aleksandra_budnik Heyy, I am getting '#VALUE! ’ in the place of the result. How can i remove this?

Can you share the curret progress via JSFiddle? It’s hard to tell what causes the issue without debugging.

@aleksandra_budnik

Below is the JSfiddle

https://jsfiddle.net/4hf73zke/

Thank you

I’m sorry but I guess that formulas added via populating do not work https://jsfiddle.net/handsoncode/f3rux67d/

You may want to add them via setDataAtCell instead.

@aleksandra_budnik Can i assign formulas in setDataAtCell ? Can you please help me with an example.

Sure, here’s a basic example https://jsfiddle.net/handsoncode/jg4a3pcw/

@aleksandra_budnik In the example, the value of A1 is considered for all other rows to be calculated. Can’t we consider the value of that particular row to be calculated while inserting a new row.
Ex: B1+2 for second row, C1+2 for third row…

Yes, the formula is only a string here so you can modify it. Here https://jsfiddle.net/handsoncode/wh2egd0a/ is an updated example

Thank you for the reply @aleksandra_budnik .
I want to increment the column A, B and C, without interval . Is the below code correct.
var a = 1, b =1, c=1;
computeFormula()
{
hot.setDataAtCell(1, 2, ‘=A* B* C’ + a + b + c +) ;
a++;
b++;
c++;
},

The formulas won’t understand the =A* B* C.
It would be very intuitive to pass A * B but at this point, the plugin cannot translate it. We need to pass a coordinate, like A1, A2, A3. And if you want to use variables then
='A' + a + '*B' + b + '*C' + c
Where a, b, c are digits.

ps. If you’re not sure if the formula is correct it is recommended to log() it.

Hey @rashmiravi29

Have you tried to rewrite the formula? If so, did that work?

@aleksandra_budnik yes i tried to fix it. But its not working as the way i wanted it. I wanted the formula to be applied for every row of a column.

Have you tried the last proposed pattern?

if you want to use variables then
='A' + a + '*B' + b + '*C' + c
Where a, b, c are digits.

@aleksandra_budnik i tried it, but the problem here is the row number has to be changed every time. The example which you shared shows the rows incrementing when the insertion of new row happens automatically.

Can you share a detailed example of use? We’ll be able to adjust the calculations.

@aleksandra_budnik If suppose i have a formula like a1 * b1 * c1 and this must be incremented for each row like a2 * b2 * c2…and so on without inserting a new row. Can we make this work for the entire column?

Here is an example that may help https://jsfiddle.net/handsoncode/8y4sophq/

I keep the C column blank for calculations and I add A column to B column.

1 Like

@aleksandra_budnik Thank you. The example helped me a lot.

Great.I’m glad that helped.

As the issue is solved we can close the topic. If you’d need anything else please feel free to open a new one.