Change formula in cell based on value in another cell

V

vvaidya

Hello:
I would appreciate help with the following:

I have placed a scrollbar on a worksheet that changes the value of cell
A1 from 1 to 100

Based on the value of Cell A1, I would like a formula in cell A2to
change as follows:
e.g
When value of A1 = 1, the formula in A2 should be: "=B1"
when A1 = 2, formula in A2 should be "=C1"
When A1 = 3, formula in A2 should be "=D1"
.......... and so on

I would appreciate help with VBA code to do the above.

TIA

Vinay
 
B

Bob Phillips

=INDEX(1:1,,A1+1)

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
J

Jim Rech

You can just use a single formula to get the result you want:

=CHOOSE(A1,B1,C1,D1)

--
Jim
| Hello:
| I would appreciate help with the following:
|
| I have placed a scrollbar on a worksheet that changes the value of cell
| A1 from 1 to 100
|
| Based on the value of Cell A1, I would like a formula in cell A2to
| change as follows:
| e.g
| When value of A1 = 1, the formula in A2 should be: "=B1"
| when A1 = 2, formula in A2 should be "=C1"
| When A1 = 3, formula in A2 should be "=D1"
| ......... and so on
|
| I would appreciate help with VBA code to do the above.
|
| TIA
|
| Vinay
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top