Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Cell shadowing, avoid entering same formula multiple times #170
It's a usual scenario, when we have several lines (records), with some data fields and some formulas. When we add a new record, we just clone the last line, replace the data fields, but formulas remain unchanged. Finally we have a set of formulas cloned, as many times, as many lines we have.
When we enhance the formula, there are several issues:
Solution: cell cloning. A cell, which is a clone, should contain only a reference to the cloned cell. Upon evaluation, the cloned cell's formula applies.
Thanks @ern0, that's a great idea! Really great. It would address a lot of the issues around incomplete/inconsistent formula vectors which is a common error in spreadsheets.
Just thinking about how this would be implemented:
It would complement the cell mapping idea #118 (which would be useful for projecting native vectors or arrays onto the grid e.g. a R vector could be projected down a column using the formula
Introducing shadow cell concept adds a layer to the model. Now we have two kind (OOP: class) of cells: native and shadow, so every operation (OOP: method) on the cell is doubled, one for native, one for shadow.
I think, the concept of shadow cell feature is pretty clear, the data representation and implementation is not too difficult, but it has strong effect on UI, which should be designed carefully.
When we copy a (non-shadow) cell, should we paste value or make target cell shadow? I've bought your idea that "values should be copied, formulas should be cloned". Value-copy is trivial (it makes no sense to clone a value, if one wants see the same value in the target cells, he or she can make vanilla references, it will "clone" the values). Formula-clone vs formula-copy, I think, is 80% - 20%, so make cloning the default is unquestionable. For the remaining 20% (e.g. when we want to create a new formula based on the copied one), some extra GUI functions should be implemented:
I think format should be like:
c1:c4 = a1:a4 + b1:b4
Also maybe a RC style should be allowed like in Excel and orgmode.
Also perhaps you can look at the orgmode format: http://orgmode.org/manual/The-spreadsheet.html#The-spreadsheet, http://orgmode.org/worg/org-tutorials/org-spreadsheet-intro.html
Aside To talk a little about orgmode as sirinath mentioned: Org mode has a concept of row and column formulae, this deals with the problem of "adding data but forgetting to update formulae"
I want to try to mutter philosophically about this a little, because I think this is a thorny problem.
Generalising a little, the underlying problem here is:
The trade off here is often between the the ease of these different activities.
Broadcasting, with a direct acyclic graph display
There is a commonly used piece of software called
I think the DAG approach has benefits, although there's a cost in terms of familiarity and not being able to see everything at once... and not giving you a display. Of course this approach doesn't stop you from also having spreadsheets.
Now... if your spreadsheet supports numpy or R arrays there is a different approach, you place your entire array in a single cell, and then use R / numpy for broadcasting. Perhaps providing a way to map an entire spreadsheet table into a cell
Very closely related (if not identical to the idea of clone cells) is a paper I found recently by Felienne Hermans & Tijs Van Der Storm Copy-Paste Tracking: Fixing Spreadsheets Without Breaking Them