+ Reply to Thread
Results 1 to 6 of 6

Random name generator

  1. #1
    Registered User
    Join Date
    11-18-2009
    Location
    England
    MS-Off Ver
    Excel 2016
    Posts
    88

    Random name generator

    In column A there will be a list of names in column B team and column C location

    in cell D1 and D2, i want two names they need to be different and not from same location or team.

    Is this something that can be done by formula

  2. #2
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Random name generator

    Hi,

    Assuming entries in A1:C20:

    In D1:

    =INDEX(A1:A20,RANDBETWEEN(1,COUNTA(A1:A20)))

    In D2, array formula**:

    =INDEX(A1:A20,INDEX(MODE.MULT(IF(MMULT(N(B1:C20=INDEX(B1:C20,MATCH(D1,A1:A20,0),)),{1;1})={0,0},ROW(B1:C20))),RANDBETWEEN(1,COUNT(1/(MMULT(N(B1:C20=INDEX(B1:C20,MATCH(D1,A1:A20,0),)),{1;1})=0)))))

    I chose an end row reference of 20 here, which obviously you can amend to meet your requirements, though you should be careful not to make it too arbitrarily large (and certainly don't reference entire columns!), since, for each additional cell referenced, extra calculation will be required (array formulas calculate over all cells passed to them, whether technically beyond the last-used cells in those ranges or not).


    **Array formulas are not entered in the same way as 'standard' formulas. Instead of pressing just ENTER, you first hold down CTRL and SHIFT, and only then press ENTER. If you've done it correctly, you'll notice Excel puts curly brackets {} around the formula (though do not attempt to manually insert these yourself).
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  3. #3
    Registered User
    Join Date
    11-18-2009
    Location
    England
    MS-Off Ver
    Excel 2016
    Posts
    88

    Re: Random name generator

    Hi on some names D2 just brings back a 0, any ideas?

  4. #4
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Random name generator

    Do you have any blanks in any of the ranges you used in your version of the formula?

    Regards

  5. #5
    Registered User
    Join Date
    11-18-2009
    Location
    England
    MS-Off Ver
    Excel 2016
    Posts
    88

    Re: Random name generator

    Its working now, no idea what i had done wrong

  6. #6
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Random name generator

    Ok, glad you got it sorted!

    Cheers

+ 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. Random Name generator VBA
    By poppeters in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-11-2015, 09:13 PM
  2. Replies: 5
    Last Post: 06-21-2013, 10:40 AM
  3. VBA for random generator
    By arn2025 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-07-2012, 06:45 PM
  4. random generator
    By arn2025 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-04-2012, 04:17 AM
  5. VBA Random Generator
    By switm in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-22-2011, 02:22 PM
  6. random name generator
    By rookie37 in forum Excel General
    Replies: 16
    Last Post: 06-23-2009, 03:00 AM
  7. Random Generator
    By Duncan1 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-11-2007, 08:07 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