Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Temporary variables in Excel formulas

Tags:

excel

=OFFSET(INDIRECT(ADDRESS(ROW(), COLUMN())),-4,2+MATCH(MIN(OFFSET(INDIRECT(ADDRESS(ROW(), COLUMN())),0,3,1,10)), OFFSET(INDIRECT(ADDRESS(ROW(), COLUMN())),0,3,1,10), 0),1,1)

in the above example (don't consider what it does), I have to evaluate twice the exact same expression : OFFSET(INDIRECT(ADDRESS(ROW(), COLUMN())),0,3,1,10)

Is there a way to add variables on the fly in formulas? So that we store once the result and simply refer to it later on within the formula ? This is an example in which the cost of computing several times the same thing has no impact, but what about more costly calls or computations ?

I'm thinking of some feature that are existing in recursive functional languages such as Caml.

like image 666
BuZz Avatar asked Feb 03 '12 11:02

BuZz


People also ask

Can I use variables in Excel formulas?

The Excel LET function allows you to assign names to calculation results and define variables inside a formula, so that the formula looks clearer and works faster. Essentially, the concept is the same as naming cells, ranges and formulas in the Name Manager.

What are Excel cell variables?

Variable cells (Changing cells or Adjustable cells in earlier versions) are cells that contain variable data that can be changed to achieve the objective. Excel Solver allows specifying up to 200 variable cells.

What is RC formula in Excel?

Here, R refers to the Row and C refers to the column, so R1C1 would refer to the cell in the first row and first column. Similarly, R2C3 would refer to the cell in the second row and third column.


1 Answers

If your question relates to the convenience of writing formulas, the Name Manager is what you're looking for. See in the ribbon menu in the tab "formulas". Click on "new"

Name: MyArray

Scope: Workbook

Refers to: =OFFSET(INDIRECT(ADDRESS(ROW(), COLUMN())),0,3,1,10)

If your question relates to computation cost, I believe your only solution is to physically store the intermediate results in an additional column or separate worksheet.

like image 78
Erik L. Avatar answered Oct 20 '22 00:10

Erik L.