+ Reply to Thread
Results 1 to 2 of 2

Pick random cell in col of sheet regardless of length and ignore empty cells

  1. #1
    Registered User
    Join Date
    11-16-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    22

    Pick random cell in col of sheet regardless of length and ignore empty cells

    Hello all

    I have posted here before and there were some really nice helpful people here, so I am back!

    Ok, I have got this to work:

    in RandCli sheet I have in F2 the number 1, then F3 the number 2 up to F73834 I have 73833. In the G col I have some random number in each cell starting from G2 to G73834 that I have got from another source.

    On another sheet I have this:

    =VLOOKUP(RANDBETWEEN(1,73833),RandCli!$F$2:RandCli!$G$73834,2)

    Which basically picks one of the cells from G2 down at random.

    This seems to work, although you guys probably think that is probably not a very smart way of doing it!

    This works because I have a fixed number of cells so I can hard code the $F$2 and $G$73834

    In similar way I have another sheet called TargetNum.

    The B col in has some of the cells populated with values. The problem is I want the rand lookup to work where there might be ANY number of cells populated in the B col.

    There maybe as few as 1 or as many as hundreds.

    I got as far as this:

    =VLOOKUP(RANDBETWEEN(1,COUNTA(TargetNum!$B$2:$B$65000)),TargetNum!$A$2:TargetNum!$B$11,2)

    Where I counted how many populated cells were in the B col, so that part of the vlookup worked, but I had to hard code TargetNum!$B$11, cos for testing I had 10 cells populated.

    I couldn't find a way to replace the 11 with the results of the counting calculation, like 1+COUNTA(TargetNum!$B$2:$B$65000)

    I'm sorry if I don't explain my self very well!

    Has anyone got any ideas, or is there a much better way of doing this full stop?

    Thanks in advance!

  2. #2
    Registered User
    Join Date
    11-16-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    22

    Re: Pick random cell in col of sheet regardless of length and ignore empty cells

    Sorry, I think I should have put this in the basics sub forum.

    I don't know how to move it my self.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Pick Random Value from a Range (not including empty Cells)
    By ghoneim in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-22-2013, 04:46 AM
  2. Replies: 1
    Last Post: 01-22-2013, 03:45 PM
  3. Pick a random cell within range of another sheet
    By PY_ in forum Excel General
    Replies: 4
    Last Post: 04-08-2011, 03:10 PM
  4. Multiple cells and ignore empty cell
    By fbjorkma in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-01-2008, 04:02 PM
  5. Formula to use number in cell to left & ignore any empty cells
    By joya in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-13-2007, 12:52 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1