Changing a cell reference within a formula w/another cell

T

tx12345

Hi

Let's say I have this formula in A1:

=if(A2=2,"Hello","")

But let's say I want to make the location of where the '2' has to be to
trigger the 'Hello' in A1 conditioned on a value in B1, and let's say B1
changes to 5. So now instead of the formula in A1 saying
=if(A2=2,"Hello","") I will want it to say =if(A5=2,"Hello","").

Many thanks as always

tx
 
D

davesexcel

I am confused, are you asking for 2 formulas in one cell, this can be
done I just want to be sure that is what you are asking:
for example
=if(A2=2,"Hello",if(A5=2,"Hello",""))
Is this what you mean??
 
M

Max

One way, think we could use in A1:
=IF(INDIRECT("A"&B1)=2,"Hello","")
where B1 will contain the row reference
 
Top