ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to turn a string into a formula? (https://www.excelbanter.com/excel-programming/315282-how-turn-string-into-formula.html)

rocky

How to turn a string into a formula?
 
I want to reference another sheet's cell contents based on a randomly
generated row number. So I do the following:

Say cell B1 has the formula "=INT(RAND()*10)" to generate a random row
number. Say the generated random number is 5.

Based on this I try to get the cell contents from another sheet with
this equation = ="Sheet1!A" & B1

But this formula ends up returning the string "Sheet1!A5" which is
correct, but like I said it returns a string and not a formula to grab
the cell contents of another sheet.

Anyone know how to make this string a formula?

tia, Ray

Bob Phillips[_6_]

How to turn a string into a formula?
 
Ray,

Try

=INDIRECT("Sheet1!A"&B1)

--

HTH

RP

"rocky" wrote in message
...
I want to reference another sheet's cell contents based on a randomly
generated row number. So I do the following:

Say cell B1 has the formula "=INT(RAND()*10)" to generate a random row
number. Say the generated random number is 5.

Based on this I try to get the cell contents from another sheet with
this equation = ="Sheet1!A" & B1

But this formula ends up returning the string "Sheet1!A5" which is
correct, but like I said it returns a string and not a formula to grab
the cell contents of another sheet.

Anyone know how to make this string a formula?

tia, Ray





All times are GMT +1. The time now is 12:18 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com