Arthur Lindley wrote:Is there a function "****" which acts to reverse the action of "FORMULA"?
Let's consider this a bit.
=FORMULA(A1) is used to
get the formula for cell A1, so presumably **** would somehow
set the formula for that cell. A fundamental principle is that each non-empty cell contains either data or a formula.
The formula calculates a result which becomes the value of the cell containing the formula. The formula affects only the value of the cell which contains it, and never changes the content of any other cells.
So if there's some formula in A1 that we want to manipulate we can use
=FORMULA(A1) in B1 to get the formula's text and
=REPLACE(…) or
=SUBSTITUTE(…) or whetever in C1 to make a new formula. But where could we use ****? Not in C1 because C1's formula can never affect the content in another cell and specifically cannot affect the formula in A1. And not in A1 because that **** function would replace the very thing we want to manipulate. So **** is not possible (without programming a
macro using the API).
Although a function can't set a cell's formula, we
could have a function (presumably called EVAL) which evaluates a text string the same way that the formula processor would. If so,
=EVAL("1+2") would be 3; or with A1 containing "SUM",
=EVAL(A1&"(C4:C6)") would sum the numbers in C4 through C6. However neither Calc nor any spreadsheet I'm familiar with has implemented an EVAL function.
Arthur Lindley wrote:What I would like to do … is to create … replica sheets, but using "=MAX" and "=MIN" for each of these.
In a typical spreadsheet where we put labels in row 1, write formulas in row 2, and then fill the formulas to the remaining rows, it's just a matter of updating the formulas in row 2, highlighting those formulas, and double clicking the
fill handle to propagate them to the remaining rows. As others have mentioned, for this to be successful the formulas in row 2 have to be written with the correct relative, absolute, or mixed cell references. I also have a dicsussion of that important subject in section
8. Using formulas and cell references of
Ten concepts that every Calc user should know.
In more complicated situations, it can be helpful to modify formulas with Edit > Find & Replace > More options > Search in > Formulas. This allows you to replace AVERAGE with MAX or MIN and quickly convert
=AVERAGE(A2:A9) to
=MAX(A2:A9). This might be what you're looking for.
For even more complicated situations, you can temporarily convert your formulas to text: Select the cells, Edit > Find & Replace > More options, select
Current selection only and
Regular expressions, Search for
^=(.+), Replace with
#$1, Replace All. I recommend unchecking
Current selection only and
Regular expressions, before clicking Close. This converts
=AVERAGE(A2:A9) to
#AVERAGE(A2:A9), which can now be manipulated as text. So if the formula to mainpulate is in A2, we convert it to text in A2 and perhaps use
=REPLACE(…) or
=SUBSTITUTE(…) to build a modified formula in B2. Then copy B2 and use Edit > Paste Special > Text (unselect Formulas) to update A2 by converting B2's formula value to text. Then Edit > Find & Replace > More options, select
Regular expressions, Search for
^#(.+), Replace with
=$1, Replace All to convert back from text to formulas.
Arthur Lindley wrote:I have created a sheet which tabulates the average output for each 5-min time point … for each weekly period
I would agree that this seems like something that
Data Pilot could help with. Beginners often struggle for hours writing formulas to accomplish tasks which could be done in minutes, without formulas, using DataPilot. Data Pilot could present all three statistics (average, minimum, and maximum) in the same report. There are many posts about DataPilot in this forum and if you're having trouble with it a search will probably find the answer for you.