That is the essence of my question: how can I make it simpler, clearer, and more intuitive?
I would much rather have a single formula in one place. I can do that with the Regular Expressions that are part of many of my formulas. The RE argument to REGEX()
is text so in the REGEX()
formula I can just point to a named cell that has the RE text in it.
.
But I haven’t figured out how to have a normal formula located in a single cell and then execute that full formula from multiple cells. If I could do that, I could save a lot of copying each new version of the formula down multiple rows. I have fount that it’s possible to convert a Formula to Text, using the FORMULA()
function, but there is no EXEC()
function to read a text string in a cell and execute it as a forumula that I have found yet. Do you know of a way to do this?
.
As I said in the OP, having the commentary about the formula in a separate place is a maintenance issue for me. I would like to be able to comment on Calc formulas just like I do when defining a Ruby or JavaScript operation. I usually lay out my code and comments so that the comments are visually separated from the code by indentation and the flow of the code can be followed, with the comments right there to explain each step or nesting level. That’s what I want to do in complicated Calc formulas.
.
I used to worry about having all that extra text in each cell bloating the size of the spreadsheet. But I’ve realized that such concerns date from when I had to get a whole program to fit onto a single floppy disk. I have a full terabyte of free space on my SSD drive right now so having a text file be four or ten times as big is not an issue. Calc can handle over a million rows and over 16,000 columns so my 10 or 20 columns and 500 or 1000 rows are not straining it. It calculates invisibly fast.
.
What matters most to me is having the formulas be readable when I return to work on them after some time and having the descriptions of why and how be present inline with the what. Readability, maintainability, simplicity, and aesthetics are what I care about, so I am adapting the tool beyond it’s “normal” use patterns so that it can support my style of working because I want to make my working time be as simple and straightforward as possible.
.
The patterns I described in the OP are helping a lot. I’m asking for help in making the comments aesthetically cleaner, prettier if you will.
.
I know it’s not possible to have a pattern like “# Comment to end of line...
”
because Calc formulas are not line-based and the multi-line format depends on treating Return characters as white space within a text string.
.
Is there a way of defining my own function, e.g. #()
or maybe _()
that would simply do nothing with its arguments, not even test how many there are? For my purposes, that would be a beautiful thing.
.
Right now, the best I have is something like:
=IF( InputText = "" , "" , IF(0,"A TITLE for the Formula Goes Here","")&
SEARCH( IF(0,"
What I am SEARCHing for, and WHY,
goes here, including what my source is
and what I am going to do with the result.
","")&
Target , IF(0,"
Note that syntactically, this comment is
attached to the InputText string, because
it comes after the comma after Target, but
visually it comments on the Target parameter.
","")&
InputText ,
Start +IF(0,"
This comment is attached to the Start parameter,
which is a number, so it must use + instead of &
and it must end in 0 instead of and empty string.
",0)
)
)
As you can see, I have a pattern that works fairly well, but I find the IF(...)
structure and those final parameters, the ""
and the 0
, to be overly complicated for simple typing and reading. That’s what I would like to simplify, if I can.
.
Thanks for listening.