+ Reply to Thread
Results 1 to 4 of 4

How to Ignore Blank cells while using "Randbetween" function

  1. #1
    Registered User
    Join Date
    04-25-2022
    Location
    Caledon, ON, Canada
    MS-Off Ver
    MS Office 365
    Posts
    13

    How to Ignore Blank cells while using "Randbetween" function

    Hi, I just joined after searching for a solution to my problem. I am using MS Office Excel 365. I first started with this formula =INDEX(C4:C18,RANDBETWEEN(1,15)). When I have less than 15 names to choose from I sometimes get a random value of zero. I used an Array from another solution I found on this forum but on occasion the random value generated is zero instead of a name. I have entered the formula as an Array for the range I need. In my current example I have a maximum of 15 cells to randomly select a name but in this case I only have 8 names to randomly select, the rest are blank. The number of names can change from day to day from 4 to 15 names. My blank cells in my Array do contain formulas referencing another tab ie. ='Lookup Data'!H10 if that makes a difference.

    This is my Array formula based on the solution provided in a previous post.
    {=INDEX(C:C,INDEX(MODE.MULT(IF(C4:C18<>{"",""},ROW(C4:C18))),RANDBETWEEN(1,SUM(N(LEN(C4:C18)>0)))))}

    Hopefully I have provided enough information.

    Thank you for any help.

    Dave
    Last edited by thestampdad; 04-26-2022 at 05:40 AM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2507 (Windows 11 Home 24H2 64-bit)
    Posts
    91,786

    Re: How to Ignore Blank cells while using "Randbetween" function

    Welcome to the forum.

    There are instructions at the top of the page explaining how to attach your sample workbook.

    A good sample workbook has just 10-20 rows of representative data that has been desensitised. It also has expected results mocked up, relevant cells highlighted and a few explanatory notes.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  3. #3
    Valued Forum Contributor
    Join Date
    07-23-2013
    Location
    London, England
    MS-Off Ver
    Office 365
    Posts
    988

    Re: How to Ignore Blank cells while using "Randbetween" function

    Try in E1:

    =LET(r,C4:C18,x,FILTER(r,r<>0),INDEX(x,RANDBETWEEN(1,ROWS(x))))

  4. #4
    Registered User
    Join Date
    04-25-2022
    Location
    Caledon, ON, Canada
    MS-Off Ver
    MS Office 365
    Posts
    13

    Re: How to Ignore Blank cells while using "Randbetween" function

    Quote Originally Posted by nick.williams View Post
    Try in E1:

    =LET(r,C4:C18,x,FILTER(r,r<>0),INDEX(x,RANDBETWEEN(1,ROWS(x))))
    Thank you very much Nick, that works perfectly.

    Have a great day.

    Dave

+ 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] How to Skip Blank cells while using "Randbetween" function
    By ehabmad in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 04-25-2022, 10:14 AM
  2. [SOLVED] Pivot Table / Chart Ignore / Exclude blank "" cells created using IF formula
    By randomreflex in forum Excel Charting & Pivots
    Replies: 5
    Last Post: 05-23-2018, 08:59 AM
  3. [SOLVED] Skip Blank cells while using "Randbetween" function
    By Ravana in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-10-2017, 07:58 AM
  4. [SOLVED] How to get VBA to ignore "blank" cells or cells with "text"
    By mss90 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-02-2016, 10:32 AM
  5. Using the "DAYS360" function-ignore blank cell
    By wvpersephone13 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-17-2014, 12:54 AM
  6. Ignore Spaces in "Blank" Cells
    By Oriana in forum Excel General
    Replies: 3
    Last Post: 09-25-2007, 01:26 PM
  7. making graphs ignore "blank " cells
    By Guillermo in forum Excel General
    Replies: 4
    Last Post: 02-22-2005, 06:06 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