Excluding cells using RANDBETWEEN

frankstr

New Member
Joined
Apr 25, 2020
Messages
2
Office Version
  1. 2010
Platform
  1. Windows
Hello all. I have two columns of data with around 200 rows, all text. Column A has no blank cells, but column B does. I'm using the following formula to randomly select a cell from column A:

=INDEX(A2:A210,RANDBETWEEN(1,ROWS(A2:A210)))

The problem is, I need to exclude results where there is data in the corresponding cell in column B. i.e. I need to only show results from column A where the corresponding cell in column B is blank.

Is there a way to alter the formula I'm using to get this result?

Thanks very much in advance
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Perhaps something like

=INDEX(A:A,AGGREGATE(15,6,ROW(A2:A210)/(B2:B210<>""),RANDBETWEEN(1,COUNTIF(B2:B210,""))))
 
Last edited:
Upvote 0
Maybe

=INDEX(A:A,AGGREGATE(15,6,ROW(A2:A210)/(B2:B210=""),RANDBETWEEN(1,COUNTBLANK(B2:B210))))
 
Upvote 0
Thanks Jason and Phuoc for both of your replies. Phuoc's formula gives exactly the results I was looking for. Jason's filters things slightly differently, but I'm running Excel Starter 2010, so maybe that has something to do with it. This stuff is like another language to me, so thank you both for your kind help.
 
Upvote 0
That was an error in my formula, I misread part of your question and edited the formula after posting my reply but didn't do it correctly. It should have been

=INDEX(A:A,AGGREGATE(15,6,ROW(A2:A210)/(B2:B210=""),RANDBETWEEN(1,COUNTIF(B2:B210,""))))

Both formulas do the same thing, but we used different methods to count the number of blank cells.
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,272
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top