+ Reply to Thread
Results 1 to 12 of 12

Reverse Calculation

  1. #1
    Forum Contributor leo73pk's Avatar
    Join Date
    09-28-2006
    Location
    UAE
    MS-Off Ver
    2016, Microsoft 365
    Posts
    294

    Thumbs up Reverse Calculation

    I created a following formula to convert the number of balls bowled in a match to a number of overs in that match.

    Logic: 1 over = 6 balls

    Whereas “bb” is the cell reference wherein we insert number of balls bowled in a match.

    Formula =INT(bb/6)+(bb/6-INT(bb/6))*6/10
    The formula works fine to calculate number of overs accurately i.e. 36 balls equivalent to 6 overs similarly if we put 39 balls it converts to 6.3 Overs

    Now I want a formula that perform a reverse calculation to calculate number of balls for any number of overs (based on the same logic that 1 over =6 balls)
    Last edited by leo73pk; 06-26-2010 at 04:40 AM.

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,043

    Re: Reverse Calculation

    This maybe:

    =10*A1-4*INT(A1)

    Also, first formula is same as: =2/5*INT(B1/6)+B1/10
    Never use Merged Cells in Excel

  3. #3
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,043

    Re: Reverse Calculation

    What if someone enter 1,7 for example?
    You should get some indicator that number is wrong... Change Error in something you find usefull:

    =IF(FLOOR(10*(A1-INT(A1));6)>0;"Error";10*A1-4*INT(A1))

  4. #4
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,043

    Re: Reverse Calculation

    hmmm.. I can't figure out why formula works for numbers up to 4,5 and not further :-S

    For 4,6; 5,6; 6,6; 7,6; 8,6 etc FLOOR should be 0 (therefore result Error)
    Attached Files Attached Files

  5. #5
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Reverse Calculation

    maybe just
    =IF(A2-INT(A2)>0.5,"error",10*A2-4*INT(A2))
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  6. #6
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,043

    Re: Reverse Calculation

    Yes.. I was thinking about it at the first.. But then I realize that 0,42 would give FALSE while ti rather need to be TRUE...

    It will also my FLOOR formula works but now I still can't figure out why ti's not working for upper numbers

  7. #7
    Forum Contributor leo73pk's Avatar
    Join Date
    09-28-2006
    Location
    UAE
    MS-Off Ver
    2016, Microsoft 365
    Posts
    294

    Re: Reverse Calculation

    Quote Originally Posted by zbor View Post
    Yes.. I was thinking about it at the first.. But then I realize that 0,42 would give FALSE while ti rather need to be TRUE...

    It will also my FLOOR formula works but now I still can't figure out why ti's not working for upper numbers
    let me elaborate for more clarity.

    1 over consist of 6 balls. therefore,

    1.5 overs means one over and five balls, not one and a half overs.

    Hope this will clarify.

  8. #8
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Reverse Calculation

    why would anyone knowing cricket put 0.42 come to that >0.5 ?

  9. #9
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,043

    Re: Reverse Calculation

    I don't even know that this is cricket and even less it's rules XD

  10. #10
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Reverse Calculation

    well it is so
    =IF(A2-INT(A2)>0.5,"error",10*A2-4*INT(A2)) should do since
    2.5 is 2 overs 5 balls =17

    or if you really need to make sure no one puts 1.42
    =IF(OR(A2-INT(A2)>0.5,ROUND(A2-INT(A2),1)<>ROUND(A2-INT(A2),3)),"error",10*A2-4*INT(A2))
    now im just following on from whats there coz im sure donkyote has some better cricket functions
    Last edited by martindwilson; 06-24-2010 at 06:34 AM.

  11. #11
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Reverse Calculation

    If you're using lots of calcs for base 6 then IMO the likes of DOLLARDE / DOLLARFR are very useful
    (worth activating the Analysis ToolPak Add-In for those running versions pre XL2007)

    For balls to overs:

    =DOLLARFR(balls/6,6)

    For overs to balls

    =DOLLARDE(overs,6)*6

    In terms of approaches that avoid ATP dependency

    For balls to overs:

    =INT(balls/6)+MOD(balls,6)*10

    For overs to balls:

    =INT(overs)*6+MOD(overs,1)*10

    (you might need to Round)

  12. #12
    Forum Contributor leo73pk's Avatar
    Join Date
    09-28-2006
    Location
    UAE
    MS-Off Ver
    2016, Microsoft 365
    Posts
    294

    Re: Reverse Calculation

    Thanks Donkey Ote that formula works fine.

+ 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