Consulting

Results 1 to 4 of 4

Thread: Birthday code? help needed

  1. #1
    VBAX Regular
    Joined
    Apr 2012
    Posts
    13
    Location

    Birthday code? help needed

    Hi i am trying to write a code but have no idear how to do it..

    can some one please help me with it

    i am trying to give a random group of 23 people birthday dates and how likely is it that two people have the same birthday i need to write a program that will create the person array or ranging 1 to 23 and assign to each of the 23 people a random date for there "birthday" and expanding it by repeating it 100 times counting how many groups of 23 persons have at least one watching birthday the answer needs to be around 50%

    thanks
    i am really stuck and have no idear what to do
    this is what i have so far

    Private Sub Document_Open()
    Randomise
    End Sub

    yea i basically no nothing

    if some one can help me i would be happy to throw a few dollars there way

  2. #2
    VBAX Master
    Joined
    Feb 2011
    Posts
    1,480
    Location
    Why do you want to start in Word when what you're doing is a statistical analysis on numbers? I could get you a bit further in creating the array of people and random dates as birthdays, and then expanding that loop multiple times is trivial. But I'm not sure what the rest of your statement means. "One watching birthday the answer needs to be around 50%" -- Punctuation may help, but you pretty much lost me on that. I'm assuming you want some kind of result out of a random function? That may be, theoretically speaking, kind of tough.

    But be that as it may... the VBA between Excel and Word for simply creating an array and populating it could be the same, but I would actually start in the Excel forum, unless there is some compelling reason for your output to be in Word format. There may be some functionality natively available in Excel regarding number analysis which isn't as easily available in Word.

    I don't have a really deep knowledge of Excel formulas off the top of my head, but there are some who do. I'd cross-post this in the Excel forum here, include a link here (following typical cross-post etiquette)... and then re-ask the question.

  3. #3
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,750
    Location
    This is a pretty common homework-type problem in probablity

    http://en.wikipedia.org/wiki/Birthday_problem

    Not saying that the OP is looking for homework help, but the link explains in a lot of detail

    Paul

  4. #4
    VBAX Wizard
    Joined
    May 2004
    Posts
    6,713
    Location
    LOL! If the OP is looking for a homework solution, the link should move them along quite nicely.

    I quite agree that this is not a Word thing. This is an Excel thing.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •