You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
is it possible to do an automatic cell reference calculation or calculation as in excel when dropping down the + at the down right (in combination with handsontable)?
If I'm not mistaken, this might be achieved in HyperFormula in two ways:
a) by copying the formula to all the cells below,
b) by filling the range using the getFillRangeData method.
I know this might be counter-intuitive at first glance, but both the methods work as we operate on relative addresses underneath :)
@bardek8 thank you. It seems to work with getFillRangeData with Cell references.
Does this also work with e.g. numbers?
1,2,3 =>
1,2,3,4,5
?
It results to 1,2,3,1,2 for me.
If HF has no implementation for this, can you name me approach what can I do to implement such a logic?
No, currently HF has no mechanism for detecting the integer sequences and 1,2,3,1,2 is the intended behavior for now.
We did try a bit to understand the logic here, but it turns out to be very complicated. For example we can have:
1,3,2...
"day 1", "day 2", ...
"Monday", "Tuesday", ...
"1 a 1", "2 a 2", ...
For the arithmetic progressions from your example, in order to obtain the new element of the sequence you can add the difference between last two numbers to the last number.
On a side note, developers who integrate Handsontable in their apps can use beforeAutofill to implement custom autofill behaviour: handsontable/handsontable#133
Activity
bardek8 commentedon Jan 21, 2022
If I'm not mistaken, this might be achieved in HyperFormula in two ways:
a) by copying the formula to all the cells below,
b) by filling the range using the
getFillRangeDatamethod.I know this might be counter-intuitive at first glance, but both the methods work as we operate on relative addresses underneath :)
doczoidberg commentedon Jan 21, 2022
@bardek8 thank you. It seems to work with
getFillRangeDatawith Cell references.Does this also work with e.g. numbers?
1,2,3 =>
1,2,3,4,5
?
It results to 1,2,3,1,2 for me.
If HF has no implementation for this, can you name me approach what can I do to implement such a logic?
bardek8 commentedon Jan 21, 2022
Great to hear that it worked!
No, currently HF has no mechanism for detecting the integer sequences and 1,2,3,1,2 is the intended behavior for now.
We did try a bit to understand the logic here, but it turns out to be very complicated. For example we can have:
For the arithmetic progressions from your example, in order to obtain the new element of the sequence you can add the difference between last two numbers to the last number.
doczoidberg commentedon Jan 21, 2022
seems to be some string manipulation and excel's
TRENDfunction (which is not supported in hf)https://superuser.com/questions/1334032/what-exactly-is-excels-auto-fill-algorithm
warpech commentedon Feb 10, 2022
What works: The problem in topic, as it is already used in Handsontable (see example: https://jsfiddle.net/t69xfk0z/, see source: https://github.com/handsontable/handsontable/blob/cf14362f963befe2d7ecbbda733e721a300b4bb2/handsontable/src/plugins/formulas/formulas.js#L607)
What doesn't work:
getFillRangeData, only a short API reference and a mention in two blog posts: https://handsontable.com/blog/articles/2021/10/whats-new-in-hyperformula-1.3.0, https://handsontable.com/blog/articles/2021/7/hyperformula-1-0-0-has-landed. A guide is needed.doczoidberg commentedon Feb 10, 2022
@warpech the example shows the calculation of cell references. This works, yes. But it does not extrapolate numbers and numbers in strings yet
sequba commentedon Feb 10, 2022
@warpech I created issues to track these 2 tasks:
Closing this one
warpech commentedon Feb 14, 2022
@doczoidberg we will follow this idea for HyperFormula in the new issue #903.
Please keep in mind that HyperFormula is a library. If your intention is that this would be a nice feature in Handsontable formula plugin, I would be grateful for writing a feature request in Discussions: https://github.com/handsontable/handsontable/discussions/categories/ideas
On a side note, developers who integrate Handsontable in their apps can use
beforeAutofillto implement custom autofill behaviour: handsontable/handsontable#133