+ Reply to Thread
Results 1 to 4 of 4

Binary Counter

  1. #1
    Forum Contributor
    Join Date
    01-25-2011
    Location
    Virginia
    MS-Off Ver
    Excel 2016
    Posts
    166

    Binary Counter

    I need to determine the posible outcomes of 4 football games. There are 2^4 (16) possible combinations which can be represented by the binary numbers 0000 to 1111. I need to cycle though each possible outcome to determine final standings. I know how to do this if I can come up with a sub that counts through those bianary numbers.

    Any ideas?

    Thanks in advance,

    Tom
    Last edited by tom.hogan; 11-14-2011 at 09:54 PM.

  2. #2
    Forum Contributor
    Join Date
    11-25-2010
    Location
    Glasgow, Scotland
    MS-Off Ver
    Excel 2007
    Posts
    120

    re: Binary Counter

    Hi there,

    Excel has a function you can use to convert Binary to Decimal called:

    BIN2DEC(number)

    Perhaps you can use this alongside the binary numbers to perform the calculation?

    That said I'm not sure exactly how many calculations there are. Either way you can still use this function even in your code maybe like:

    Please Login or Register  to view this content.
    lifesigns
    If the post was helpful please click the black star on the bottom left to add some reputation and mark your thread as SOLVED.

    A day with nothing new achieved or learned, albeit however small, is a day lost forever?

    Constant Never Ending Improvement

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    re: Binary Counter

    Another way; in A1 and copy across and down,

    =MOD(INT( (ROWS($A$1:A1) - 1) / 2 ^ (COLUMNS($A$1:A1) - 1)), 2)

    If you want instead to start in, say, B5, then

    =MOD(INT( (ROWS($B$5:B5) - 1) / 2 ^ (COLUMNS($B$5:B5) - 1)), 2)
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Forum Contributor
    Join Date
    01-25-2011
    Location
    Virginia
    MS-Off Ver
    Excel 2016
    Posts
    166

    Re: Binary Counter

    Life signs thanks that worked.

    Tom

+ 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