+ Reply to Thread
Results 1 to 4 of 4

Pick Random Value from a Range (not including empty Cells)

  1. #1
    Registered User
    Join Date
    10-19-2012
    Location
    Egypt
    MS-Off Ver
    Excel 2003
    Posts
    40

    Pick Random Value from a Range (not including empty Cells)

    Hi,
    I've come across this formula that picks random cell value from a determined range -say from column (A) to (C) - the whole columns

    =INDEX($A:$C,RANDBETWEEN(1,COUNTA($A1:$A65536)),RANDBETWEEN(1,3))

    However, it seems like when a cell is empty in the middle of range (say in the middle of column B), it may get picked as well returning 0 as value.
    Is there any work-around to limit random selection only on cells that contain values?

    I'd appreciate your help.

  2. #2
    Registered User
    Join Date
    10-19-2012
    Location
    Egypt
    MS-Off Ver
    Excel 2003
    Posts
    40

    Re: Pick Random Value from a Range (not including empty Cells)

    any thoughts?

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Pick Random Value from a Range (not including empty Cells)

    Brutal formulas:

    Please Login or Register  to view this content.

    In E1 and copied through G1:

    =INDEX(A:A, LARGE(IF(A:A<>"", ROW(A:A)), RANDBETWEEN(1, COUNTA(A:A))))

    G2:

    =INDEX(E1:G1, MATCH(RANDBETWEEN(0, COUNTA(A:C)-1), CHOOSE({1,2,3}, 0, COUNTA(A:A), COUNTA(A:B))))
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Registered User
    Join Date
    10-19-2012
    Location
    Egypt
    MS-Off Ver
    Excel 2003
    Posts
    40

    Re: Pick Random Value from a Range (not including empty Cells)

    Problem Solved!
    Thanks a lot

+ 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. 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
  2. Replies: 10
    Last Post: 04-01-2011, 07:32 AM
  3. Replies: 5
    Last Post: 04-01-2011, 07:17 AM
  4. Trying to have excel pick random choices from specific cells.
    By Irishjames in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-10-2009, 08:10 PM
  5. pick random cells ?
    By fiur in forum Excel General
    Replies: 5
    Last Post: 11-02-2008, 12:22 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