Lottery number generation: create a single line function.
Thanks Thanks:  0
Likes Likes:  0
Page 1 of 3 123 LastLast
Results 1 to 10 of 29

Thread: Lottery number generation: create a single line function.

  1. #1
    Board Regular
    Join Date
    Feb 2002
    Posts
    99
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     
    You must install "Analysis TookPak-VBA" before doing this; check in your Excel's Tools/Add-Ins menu. Paste this long function (see below) in an Excel's worksheet (any cell) and press F9 (calculate) until you see at least 2 identical numbers. Real life's lottery does not have repeating numbers. I can disable this repetition by using cells relation but I want to use just one (1) cell. Any expert wants to challenge? If not, you can use VBA. But it still requires one (1) line of codes.

    =RANDBETWEEN(1,50)&" "&RANDBETWEEN(1,50)&" "&RANDBETWEEN(1,50)&" "&RANDBETWEEN(1,50)&" "&RANDBETWEEN(1,50)&" "&RANDBETWEEN(1,50)

    T. Le

    [ This Message was edited by: trillicomm on 2002-03-29 13:08 ]

  2. #2
    Board Regular
    Join Date
    Feb 2002
    Posts
    3,169
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    how many balls in the lottery in uk??


    Free Excel based Web Toolbar available here.

    Jack in the UK
    J & R Excel Solutions
    "making Excel work for you"

  3. #3
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Millbank, London, UK
    Posts
    1,790
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Jack : 49 balls, 6 winners

    I was looking at this lastnight and concluded it's not possible via a single formula. If anyone proves me wrong, I'll eat jellied eels and tripe for lunch for a month !

    VBA is a different matter though, I wouldn't like to stick my neck out on that one.

  4. #4
    Board Regular
    Join Date
    Feb 2002
    Posts
    99
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    To make it easier, imagine a 2-number lottery string. I am trying to think of a way to compare the first and second number within the same cell.

  5. #5
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Newcastle, UK
    Posts
    1,174
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    On 2002-03-29 12:36, trillicomm wrote:
    You must install "Analysis TookPak-VBA" before doing this; check in your Excel's Tools/Add-Ins menu. Paste this long function (see below) in an Excel's worksheet (any cell) and press F9 (calculate) until you see at least 2 identical numbers. Real life's lottery does not have repeating numbers. I can disable this repetition by using cells relation but I want to use just one (1) cell. Any expert wants to challenge? If not, you can use VBA. But it still requires one (1) line of codes.

    =RANDBETWEEN(1,50)&" "&RANDBETWEEN(1,50)&" "&RANDBETWEEN(1,50)&" "&RANDBETWEEN(1,50)&" "&RANDBETWEEN(1,50)&" "&RANDBETWEEN(1,50)

    T. Le

    [ This Message was edited by: trillicomm on 2002-03-29 13:08 ]
    I'm racking my brains here, this is an interesting question.
    Can you expand on what you mean by:

    If not, you can use VBA. But it still requires one (1) line of codes.

    Just 1. I cant see that it makes much difference, the Function on the sheet would still only be 1 cell, say =LOTTERY().


    "Have a good time......all the time"
    Ian Mac

  6. #6
    Board Regular
    Join Date
    Feb 2002
    Posts
    99
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    As long as VBA also has 1 line, too. I can do this in VBA with multiple lines of codes. But that's too easy.

    I am plugging my hair to come up with a way to assign a variable to each randbetween. Is that possible? Hmmm...

  7. #7
    Board Regular
    Join Date
    Feb 2002
    Posts
    3,169
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Children listen... i have this one sussed top to bottom

    Dave Hawley my old pal NO YOU CANT POST even Anno!

    surprised aladins not having a say...

    Ivan will solve it as wil Mark Obrian joe was old mat Mudfce and the Elephant and Castle man dk if im missed you no harm im sure you will to

    The formula is no good for UK as we have ball 1 to 49 so that dont work??? no dramas lets get it right...

    Chris i know Gangsters from the East End OK sadly my friends now passed on (yes if you guess your right the "wonderful brothers" but this is not the place for that ) but my point is ill buy you eels and tripe down whitechaple rd Bethnal Green for you and nasty tripe when i prove this one.

    Or maybe better still post a beer to Ivan i owe him that! and a beed to aladin an Dave !!!

    I have VBA which is cool that does this in a spredsheet really good.. remind me ill email it.. i have two...

    Can a formula do this.. can i cheat?? OK no i wont udf this but formula... YES it can i have such..... works first time ever time. MY Fininacial Director was going to sack me when i got caught doing this test, then i email her now we are kinda pals!

    Come on boys... Chris i spoken to a butcher in Tooting Market Tripe 100 kilos with your name on UNCOOKED!!!!




    _________________
    Good Luck
    HTH

    Rdgs
    ==========
    Jack in the UK

    [ This Message was edited by: Jack in the UK on 2002-03-30 13:12 ]

  8. #8
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Millbank, London, UK
    Posts
    1,790
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Jack...

    I dont see any formula

  9. #9
    Board Regular
    Join Date
    Feb 2002
    Posts
    3,169
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hey ive goyt the ells and tripe on order,, wheres your formula>>

    Free Excel based Web Toolbar available here.

    Jack in the UK
    J & R Excel Solutions
    "making Excel work for you"

  10. #10
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Sunny, spring-like Hull
    Posts
    3,339
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    On 2002-03-30 12:57, Jack in the UK wrote:
    Hey ive goyt the ells and tripe on order,, wheres your formula>>

    Don't post anything man, that stuff's poison .

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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

 

 
DMCA.com