I've been trying to make a formula for the 3x3 tic-tac-toe game I made in Excel. And I have trouble with displaying when both player wins, that is, when there's a tie. The problem is that once there is only one player who won or even if none of them did win, it just shows up as "false" instead of nothing. I wanna remove the "false" that shows after inserting the formula in Excel when one or neither of the player wins. Is there something wrong or is there something I need to change from the formula? For example this screenshot I took of what seems to happen, and this too.
=IF(AND(OR(A1&C2="xx";A3&C1="xx";A2&C2="xx";B1&B3="xx");B2="x") AND(OR(B1&C1="xx";A2&A3="xx");A1="x") AND(OR(C1&C2="xx";A3&B3="xx");C3="X");IF(AND(OR(A1&C2="oo";A3&C1="oo";A2&C2="oo";B1&B3="oo");B2="o") AND(OR(B1&C1="oo";A2&A3="oo");A1="o") AND(OR(C1&C2="oo";A3&B3="oo");C3="O");"= TIE";""))
CodePudding user response:
I don't see the point of your formula. Why use OR nested in AND when you can simply check 3 cells at once to spot a victory? Try this (italian version ready):
=SCEGLI(1 (CONTA.VUOTE(A1:C3)>0)*1 O(A1&B1&C1="xxx";A2&B2&C2="xxx";A3&B3&C3="xxx";A1&A2&A3="xxx";B1&B2&B3="xxx";C1&C2&C3="xxx";A1&B2&C3="xxx";A3&B2&C1="xxx")*2 O(A1&A2&A3="ooo";B1&B2&B3="ooo";C1&C2&C3="ooo";A1&B1&C1="ooo";A2&B2&C2="ooo";A3&B3&C3="ooo";A1&B2&C3="ooo";A3&B2&C1="ooo")*4 (ASS(CONTA.SE(A1:C3;"x")-CONTA.SE(A1:C3;"o"))>1)*8 (CONTA.SE(A1:C3;"o") CONTA.SE(A1:C3;"x") CONTA.VUOTE(A1:C3)<>9)*16;"Tie";"Game is on";"PlayerX";"PlayerX";"PlayerO";"PlayerO";"Error - Game continued after victory";"Error - Skipped turn";"Error - Skipped turn";"Error - Skipped turn";"Error - Skipped turn";"Error - Skipped turn";"Error - Skipped turn";"Error - Skipped turn";"Error - Invalid imput";"Error - Invalid imput";"Error - Invalid imput";"Error - Invalid imput";"Error - Invalid imput";"Error - Invalid imput";"Error - Invalid imput";"Error - Invalid imput";"Error - Invalid imput";"Error - Invalid imput";"Error - Invalid imput";"Error - Invalid imput";"Error - Invalid imput";"Error - Invalid imput";"Error - Invalid imput";"Error - Invalid imput")
Same formula for english version:
=CHOOSE(1 (COUNTBLANK(A1:C3)>0)*1 OR(A1&B1&C1="xxx",A2&B2&C2="xxx",A3&B3&C3="xxx",A1&A2&A3="xxx",B1&B2&B3="xxx",C1&C2&C3="xxx",A1&B2&C3="xxx",A3&B2&C1="xxx")*2 OR(A1&A2&A3="ooo",B1&B2&B3="ooo",C1&C2&C3="ooo",A1&B1&C1="ooo",A2&B2&C2="ooo",A3&B3&C3="ooo",A1&B2&C3="ooo",A3&B2&C1="ooo")*4 (ABS(COUNTIF(A1:C3,"x")-COUNTIF(A1:C3,"o"))>1)*8 (COUNTIF(A1:C3,"o") COUNTIF(A1:C3,"x") COUNTBLANK(A1:C3)<>9)*16,"Tie","Game is on","PlayerX","PlayerX","PlayerO","PlayerO","Error - Game continued after victory","Error - Skipped turn","Error - Skipped turn","Error - Skipped turn","Error - Skipped turn","Error - Skipped turn","Error - Skipped turn","Error - Skipped turn","Error - Invalid imput","Error - Invalid imput","Error - Invalid imput","Error - Invalid imput","Error - Invalid imput","Error - Invalid imput","Error - Invalid imput","Error - Invalid imput","Error - Invalid imput","Error - Invalid imput","Error - Invalid imput","Error - Invalid imput","Error - Invalid imput","Error - Invalid imput","Error - Invalid imput","Error - Invalid imput")
Note that the english version uses "," instead of ";".