+ Reply to Thread
Results 1 to 3 of 3

Help with RAND (I think...)

Hybrid View

adamturner Help with RAND (I think...) 12-04-2013, 10:32 AM
ragulduy Re: Help with RAND (I... 12-04-2013, 10:45 AM
adamturner Re: Help with RAND (I... 12-05-2013, 06:27 AM
  1. #1
    Registered User
    Join Date
    12-04-2013
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    2

    Help with RAND (I think...)

    Hello all,

    I've used the forums to answer a lot of my queries but now I have something that I wouldn't even begin to know how to approach.

    I'm not certain where this should be posted (formulas or macros etc...) so any pointers would be great!

    Hopefully this picture sums up what I'm trying to achieve (by having excel choose 2 random items from the list, I would then click yes/no. If yes is clicked then the items are added to a group. Groups are built upon by continually comparing random items from the list. A new group would be created if yes was clicked but the items were not in a current group):
    excel help.png

    Apologies if this request is too complex, as I stated I don't know how to even approach it!

    Kind regards,
    Adam

  2. #2
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Help with RAND (I think...)

    So I think something like:
    =index(A1:A10,randbetween(2,10))
    in D2 and D4
    then a macro for the yes button:
    Sub macro_yes()
    dim found_it
    for count = 10 to Range("F" & rows.count).end(xlup).row
      if worksheetfunction.countif(Range("F" & count & ":AA" & count),"="&Range("D2"))>0 or worksheetfunction.countif(Range("F" & count & ":AA" & count),"="&Range("D4"))>0 then
        if worksheetfunction.countif(Range("F" & count & ":AA" & count),"="&Range("D2"))=0 then cells(count,columns.count).end(xltoleft).offset(0,1) = Range("D4")  
    if worksheetfunction.countif(Range("F" & count & ":AA" & count),"="&Range("D4"))=0 then cells(count,columns.count).end(xltoleft).offset(0,1) = Range("D2")  
    found_it = 1
    end if
    next
    if not found_it = 1 then
       Range("F" & rows.count).end(xlup).offset(1,0) = Range("D2")
       Range("F" & rows.count).end(xlup).offset(0,1) = Range("D4")
    end if
    application.calculate
    end sub
    and a macro for the no button:
    sub macro_no()
    application.calculate
    end sub
    You will need calculation set to manual for this solution.

  3. #3
    Registered User
    Join Date
    12-04-2013
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Help with RAND (I think...)

    That's brilliant. Thank you so much.

    Adam

+ 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. Rand()
    By masalagirl in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-07-2010, 05:41 AM
  2. Rand
    By Sheepkin_Coat in forum Excel General
    Replies: 2
    Last Post: 07-26-2007, 10:15 AM
  3. help for RAND
    By jinvictor in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-12-2006, 07:20 PM
  4. [SOLVED] Rand()
    By Asphalt-1 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-10-2006, 03:20 PM
  5. Help with Rand
    By Jack in forum Excel General
    Replies: 5
    Last Post: 01-10-2006, 03:30 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