Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a basic formula:


which gives me a value, what I want to do is take that value (for the sake of argument '12') and use it to get another cell via another formula, i.e.

=(RANDBETWEEN(1, B<result>))

where B is the column, <result> is the result of the first formula.

Can this be done? (I'm using Excel 2013)

share|improve this question
up vote 2 down vote accepted

Try using INDEX, so if you have the =RANDBETWEEN(1,20) formula in cell D1 you can use this formula in another cell


If the first formula returns 12 then the INDEX part will return the value from B12

If you don't want the first formula in a cell you can use it directly in the second formula like this:


share|improve this answer
Perfect, I wanted to avoid macros if possible and this does just what I wanted... – Chris Skardon Jan 6 '13 at 18:36

You can make an Excel macro to solve this issue.

  • Click on the "View" tab in the Ribbon.
  • Click on "Macros."
  • Type RandomCell, then click "Create."

When the VBA window opens, paste this code directly under Sub RandomCell:

Dim Low As Double
Dim High As Double
Dim R As Double
Low = 1
High = 20
R = Int((High - Low + 1) * Rnd() + Low)
ActiveCell.Offset(R, 1).Select

If you are in cell A1, this will select cell B[random number]. Save the workbook and close the VBA window. Run the macro by doing the following:

  • Click on the "View" tab in the Ribbon.
  • Click on "Macros."
  • Select "RandomCell" and click "Run."
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .