juanora
juanora

Reputation: 542

How to change a formula according to cell value in excel?

I have a list of all my expenditures in Excel. Each day takes a line.

What do I want is to compare the difference between 2 days according to values on another cell. Example of formula. = A250 - A191 . I want to change this 250 and 191 just writing 321 and 192 in any anothe cell, automatically changing the formula to: = A321-A192.

Is it possible to do?

Upvotes: 2

Views: 1095

Answers (1)

Dmitry Pavliv
Dmitry Pavliv

Reputation: 35843

First approach (better one):

Use INDEX function:

=INDEX(A:A,Z1,1)-INDEX(A:A,Z2,1)

where Z1 contains 321 and Z2 contains 192

Second approach (maybe sligtly simplier to understand, but I don't recomend you to use it, since INDIRECT is volatile function and it recalculates each time any cell changed):

=INDIRECT("A" & Z1) - INDIRECT("A" & Z2)

Upvotes: 6

Related Questions