+ Reply to Thread
Results 1 to 11 of 11

Google Sheets Select Number From List Excluding Another List

  1. #1
    Registered User
    Join Date
    05-29-2021
    Location
    South Coast UK
    MS-Off Ver
    4.3
    Posts
    5

    Google Sheets Select Number From List Excluding Another List

    Hi all, hope this is ok in the Excel forum, I did see a lot of google sheets questions but could not find a spcidic google sheets forum on this site.

    We have a google sheet where we randomly select some numbers from a list in one column, A3 to A143, and would like to now not include a subsection of those numbers in our group, but without deleting them. That does work of course, but its not ideal. Is there an addition to the formula below that will then not select any numbers that are also in another column, maybe on another sheet.? I have attached a sample sheet, hope thats ok too.

    =ARRAY_CONSTRAIN(ARRAYFORMULA(INDEX(A3:A143,RANDBETWEEN(1,ROWS(A3:A143)),1)), 1, 1)

    Thanks all
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    12-11-2011
    Location
    Netherlands
    MS-Off Ver
    office 365
    Posts
    3,289

    Re: Google Sheets Select Number From List Excluding Another List

    With help columns i create this
    Attached Files Attached Files
    Willem
    English is not my native language sorry for errors
    Please correct me if I'm completely wrong

  3. #3
    Registered User
    Join Date
    05-29-2021
    Location
    South Coast UK
    MS-Off Ver
    4.3
    Posts
    5

    Re: Google Sheets Select Number From List Excluding Another List

    Hi Willem

    Thank you for your reply. Yes, I see what you have done,
    but that is just the same as deleting from the A column.
    What I need to do, is select from the A column, all of it,
    from A3 to A143, but not choose a number that is listed in
    another column, for instance B3 to B75, in your example.
    A3 to A143 has to be all the numbers listed, 101 to 241,
    but the rand selector should not choose any number that is
    also listed in the B3 to B75 range.

    I hope I have explained it more clearly.

    Thanks again for getting involved

  4. #4
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,077

    Re: Google Sheets Select Number From List Excluding Another List

    How about
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    05-29-2021
    Location
    South Coast UK
    MS-Off Ver
    4.3
    Posts
    5

    Re: Google Sheets Select Number From List Excluding Another List

    Hi Fluff,

    Thanks for your help. That does work, but when I edit the banned numbers column to add some numbers, and change the formula to include those cells, ie the below :
    =sortn(FILTER(A3:A143,ISNA(MATCH(A3:A143,'Banned-numbers'!A3:A35,0))),1,,RANDARRAY(rows(A3:A143)-rows('Banned-numbers'!A3:A35)+1),1)
    ...it then comes back with an error 'SORTN has mismatched range sizes. Expected row count: 118, column count: 1. Actual row count: 116, column count: 1.'.

    Any ideas why that is, and what that refers to.?

  6. #6
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,077

    Re: Google Sheets Select Number From List Excluding Another List

    Ok, you may have some duplicate numbers in the banned list, try it like
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    05-29-2021
    Location
    South Coast UK
    MS-Off Ver
    4.3
    Posts
    5

    Re: Google Sheets Select Number From List Excluding Another List

    Thats the one Mr Fluff.! Wow, thats amazing. Thank you very much for this

    I dont suppose there is a way to add the number selected to the end of the list in banned numbers as well is there.? A function or macro to run with a key press.?

    Thanks again, you deserve the title of guru

  8. #8
    Forum Expert
    Join Date
    07-06-2004
    Location
    Northern California
    MS-Off Ver
    2K, 2003, 2010, O365
    Posts
    1,490

    Re: Google Sheets Select Number From List Excluding Another List

    There is https://www.excelforum.com/for-other...mobile-os-etc/, Forum: For Other Platforms(Mac, Google Docs, Mobile OS etc).

    You could name the range in the Banned-numbers worksheet banned, then try

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    That should work as long as you keep banned defined correctly to span all the banned numbers in Banned-numbers!A3:A.

  9. #9
    Forum Expert
    Join Date
    07-06-2004
    Location
    Northern California
    MS-Off Ver
    2K, 2003, 2010, O365
    Posts
    1,490

    Re: Google Sheets Select Number From List Excluding Another List

    Why sort? A random numeric index into filter's result would be more efficient.

  10. #10
    Forum Expert
    Join Date
    07-06-2004
    Location
    Northern California
    MS-Off Ver
    2K, 2003, 2010, O365
    Posts
    1,490

    Re: Google Sheets Select Number From List Excluding Another List

    Is your end goal exhaustive random sampling without replacement? If so,

    Formula: copy to clipboard
    Please Login or Register  to view this content.

    would produce a shuffled listing of A3:A143.

  11. #11
    Registered User
    Join Date
    05-29-2021
    Location
    South Coast UK
    MS-Off Ver
    4.3
    Posts
    5

    Re: Google Sheets Select Number From List Excluding Another List

    Thanks hrlngrv,

    Thats a really good solution too, not that I understand too much of it, and the range part works a treat.

    In answer to your questions, I think the one about Sort is directed towards Mr Fluff, so I will let him answer that. But I can answer yes to the second question, the end goal is random sampling without replacement. And I appreciate the extra formula that randomly shuffles the whole selection of numbers in A3:A143, very useful to know.

    Thanks for your help, both of you, invaluable.

    PS Sorry to post this bit again, maybe I should start a new thread, but is there a way to add the number selected by the formula to the end of the list in banned numbers.? A function or macro to run with a key press.? So that when I run a set hot key it gets added to the Banned Numbers column, but not when it is recalculated each time you press delete or change another value.?

    Thanks again
    Last edited by Mrlofty; 05-30-2021 at 03:18 AM.

+ 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] Google Sheets - Generating a Sequential list based on previous values
    By lalalalalala in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 9
    Last Post: 12-13-2019, 07:05 AM
  2. Google Sheets: Looking up next/earliest due date but excluding past dates
    By Fluffybunny in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 0
    Last Post: 09-20-2019, 03:56 AM
  3. Collate data from table into one list - GOOGLE SHEETS
    By slock92 in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 0
    Last Post: 01-29-2019, 06:35 AM
  4. Google Sheets: How to pull data from Tabs in Excel to create a list
    By CR9596 in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 3
    Last Post: 08-09-2018, 11:53 AM
  5. Replies: 9
    Last Post: 02-08-2016, 11:25 AM
  6. Replies: 3
    Last Post: 04-11-2013, 04:13 AM

Tags for this Thread

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