+ Reply to Thread
Results 1 to 8 of 8

Creating a formula via VBA

  1. #1
    Registered User
    Join Date
    05-06-2007
    Posts
    9

    Creating a formula

    Posting in here cause my buddy said it fits here more:

    Hey guys, I work at an ITS department and was trying to come up with a formula/macro for a statistic professor and to no avail, unsuccessful. I have a set amount of numbers 1-10 (everytime a number is picked it cannot be used again). Each row is an event and there are 4 columns, IE:

    1 2 3 4
    2 3 4 5
    3 4 5 6
    4 5 6 1
    5 6 1 2
    6 1 2 3

    My question is if I were to pick the number 6 what are the chances that the number 5 will be chosen with it? This has been a very difficult problem for me to solve. Any suggestions and many thanks.
    Last edited by pik6235571; 05-09-2007 at 12:51 AM.

  2. #2
    Registered User
    Join Date
    05-06-2007
    Posts
    9
    Anyone know what kinda of statistic function i should be using? The "If" "then" functions??

  3. #3
    Registered User
    Join Date
    05-06-2007
    Posts
    9
    Okay, so I asked a University professor at what kind of formula I should use to figure this type of issue out and he said this:

    In this instance, the intuitive answer is the
    correct one. In particular, the probability
    that 5 is included in your set of four numbers
    given that 6 is included is 3/9 = 1/3.

    This can be verified by the calculation

    (8 choose 2)/(9 choose 3).

    The numerator being the number of ways to select
    two numbers from eight (the 5 and 6 being
    prescribed) and the denominator being the
    number of ways to select three numbers from nine
    (the 6 being prescribed). I hope this is
    helpful to you. Often the unintuitive solution
    is the correct one, but not in this case.
    So I was wondering if anyone can help me make a excel macro/script that will do this calculation. =D

  4. #4
    Registered User
    Join Date
    05-06-2007
    Posts
    9
    bumping for love =)

  5. #5
    Registered User
    Join Date
    05-06-2007
    Posts
    9
    anyone have a clue what i am talking about?

  6. #6
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,832
    I do understand what you are asking, but, unfortunately, I didn't take enough statistics classes to get a real grasp of anything more than basic probability calculations. (Aside: I often wish I had taken more statistics classes. This kind of thing is really interesting). This is evidenced by the fact that I barely understood your university professors response.

    Perhaps if I understood his notation (8 choose 2)/(9 choose 3), I could understand what he's saying better.

    I did a quick google search. I think this is a problem that falls under combinatorials and permutations. Excel has functions for these kinds of things (see Excel help for statistical functions), but I don't know how to put them together to get the solution to the problem. When you figure it out, share with the rest of us so we can all learn.

  7. #7
    Registered User
    Join Date
    05-06-2007
    Posts
    9
    What hes saying is that with (8 choose 2) I have 10 digits to choose from which I picked 2, so I have 8 numbers to pick from. THe 8 is the 10-2 (the 5 and 6) and the 2 is for the other 2 digits I need to finish the 4 digit event. The denominator (9 choose 3) is the 10 digits minus the one I already have with the 3 other digits i need to finish the 4 digit event. Whew! Stats teachers, they really know how to boggle your mind.

    Now that I have a formula down, how can I apply it?

    Or rather here is a simpler way to look at this problem:

    Is there a way to have excel tell me what number turns up most within each row alongside 6?

  8. #8
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,832
    A little more Googling and I think the notation (8 choose 2) is how statisticians express combinatorials. So (8 choose 2) would be expressed in Excel as =COMBIN(8,2). That makes implementing the professor's solution fairly simple in Excel. But I don't understand the statistics enough to evaluate the professor's solution, nor do I understand enough to create the formula for a different problem.

    If you are having trouble understanding the statistics, I would suggest getting the theory properly understood before worrying as much about how to implement the solution in Excel. At least one of the hits I got on Google was for a stat forum similar to this one. You might try posting this question somewhere like that to find people who understand the stat theory and can explain it to you. Then, if they can't help you implement it in Excel, come back here armed with an understanding of how to get the solution, and we can help figure out how to implement the solution in Excel. It would appear that implementation will primarily involve the COMBIN function.

    Is there a way to have excel tell me what number turns up most within each row alongside 6?
    Assuming the number selection is random and you go through enough trials or events, all numbers should have equal probability of occuring. If you are looking for a way to figure out what number occurs most in a limited number of trials, that should be doable. I'm not sure exactly how I would approach it, but it would probably consist of several COUNTIF's or SUMPRODUCT's which I could then add up to see which number occurs most frequently with a 6.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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