+ Reply to Thread
Results 1 to 14 of 14

Excel 2007 : How do i write a if calculation not to count two cells with zero as a default

  1. #1
    Registered User
    Join Date
    01-14-2012
    Location
    uk
    MS-Off Ver
    Excel 2007
    Posts
    6

    How do i write a if calculation not to count two cells with zero as a default

    I have a sheet that calculates bowling scores over 8 games. When the games start all the scores are zero by default. My If statement calculates a two cells with zero as true and awards 1 point as a draw. =IF(I6>0,2,IF(I6=0,1,IF(I6<0,0,)))
    i want the if statement in E5 to disregard awarding 1 point as a draw if both A5 and B5 are 0. or blank. Show zero is turned on, as some games may have a result such as 0 - 15
    Attached Files Attached Files

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,425

    Re: How do i write a if calculation not to count two cells with zero as a default

    Maybe one way:

    =IF(OR(AND(A5=0,B5=0),AND(A5="",B5="")),0,IF(C5>0,2,IF(C5=0,1,IF(C5<0,0,))))


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,425

    Re: How do i write a if calculation not to count two cells with zero as a default

    Or, a bit shorter:

    =IF(SUM(A5,B5)=0,0,IF(C5>0,2,IF(C5=0,1,IF(C5<0,0,))))


    Regards, TMS

  4. #4
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: How do i write a if calculation not to count two cells with zero as a default

    This should work

    =IF(C5>0,2,(C5=0)*(A5>0))
    Audere est facere

  5. #5
    Registered User
    Join Date
    01-14-2012
    Location
    uk
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: How do i write a if calculation not to count two cells with zero as a default

    Thanks for the help, but i think i have made a mistake in my explanation.
    Cell f5, = IF(A5>B5,"W",IF(A5<B5,"L", IF(A5=B5,"D")))
    i require this to ignore the (A5=B5) if Cells A5 and A6 are both zero

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,425

    Re: How do i write a if calculation not to count two cells with zero as a default

    =IF(A5>B5,"W",IF(A5<B5,"L", IF(SUM(A5+B5)=0,"","D")))


    Regards, TMS

  7. #7
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: How do i write a if calculation not to count two cells with zero as a default

    Hi

    In F5, try this.

    =IF(A5>B5;"W";IF(A5<B5;"L";IF(AND(A5=0;A6=0);"";IF(A5=B5;"D"))))

    Hope to helps you.
    Attached Files Attached Files
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  8. #8
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,425

    Re: How do i write a if calculation not to count two cells with zero as a default

    if Cells A5 and A6 are both zero

    Can I ask why?

    Regards

  9. #9
    Registered User
    Join Date
    01-14-2012
    Location
    uk
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: How do i write a if calculation not to count two cells with zero as a default

    in a game, the score could be like this 10-0
    To show the zero in the for or against cells i had to activate the show zero in cells option. This means by default the Calculation i used read the blank cells as a zero
    i have put in your suggestions an d it is working ok now.
    Many Thanks

  10. #10
    Registered User
    Join Date
    01-14-2012
    Location
    uk
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: How do i write a if calculation not to count two cells with zero as a default

    Thanks this works as well,

    Quote Originally Posted by Fotis1991 View Post
    Hi

    In F5, try this.

    =IF(A5>B5;"W";IF(A5<B5;"L";IF(AND(A5=0;A6=0);"";IF(A5=B5;"D"))))

    Hope to helps you.

  11. #11
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: How do i write a if calculation not to count two cells with zero as a default

    You are welcome!

  12. #12
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,425

    Re: How do i write a if calculation not to count two cells with zero as a default

    No, I'm asking why you said:

    if Cells A5 and A6 are both zero
    A6 is in the row below A5 so why would you be checking a score on one row against the score on the next row.

    Fotis has rightly provided a solution that matches your question/request and which you have said
    Thanks this works as well
    .

    I'm just trying to understand why you want this, what it does, and how you have tested it. Do all the rows have zeroes in them at the moment? In which case, it is quite likely that it does work but for the wrong reason.

    Anyway, if you are happy with the solutions that you have been given, that's fine.

    Thanks for the rep, regards, TMS

  13. #13
    Registered User
    Join Date
    01-14-2012
    Location
    uk
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: How do i write a if calculation not to count two cells with zero as a default

    It should have been A5 - A 6 my typo.
    But its all working, i modified the cell indicator
    Regards

    Quote Originally Posted by TMShucks View Post
    No, I'm asking why you said:



    A6 is in the row below A5 so why would you be checking a score on one row against the score on the next row.

    Fotis has rightly provided a solution that matches your question/request and which you have said .

    I'm just trying to understand why you want this, what it does, and how you have tested it. Do all the rows have zeroes in them at the moment? In which case, it is quite likely that it does work but for the wrong reason.

    Anyway, if you are happy with the solutions that you have been given, that's fine.

    Thanks for the rep, regards, TMS

  14. #14
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,425

    Re: How do i write a if calculation not to count two cells with zero as a default

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

+ 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