countif cell back to 0

jarhead58

Active Member
Joined
Sep 21, 2017
Messages
348
Office Version
  1. 2016
Platform
  1. Windows
How can I return my count to "0" after using this formula
Code:
=MOD(COUNTIFS(F13:T21,R2)+COUNTIFS(F13:T21,"Ground out")+COUNTIFS(F13:T21,"Fly out")+COUNTIFS(F13:T21,"Foul out")-1,3)+1
when F13:T21 are cleared? TIA
 
I could not open the file. Since it can not be opened in Excel online it asked if I wanted to open it in Excel but it never opened.

What is in V2 of the score sheet?

For the formula to work what ever is in the "" needs to be in the cell so for this COUNTIFS(F13:T21,"DP") to work the text DP would need to be in the cell.
 
Upvote 0

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Still can not open it. I get

Reconnecting to Server As soon as the connection is restored, we'll Complete your last actions.

Do you have dropbox so I can just download the file without going though excel online.
 
Upvote 0
Your code for a double play was overwriting the formula in M5 delete the last line line
Code:
Sub DP_Click()Worksheets("Score").Range("X2").Copy
    ActiveSheet.Paste
    Application.CutCopyMode = False
    
    'The below line is overwriting the formula in M5 delete it.
    'Range("M5").Value = Range("M5").Value + 2
    
End Sub

The formula I posted in post 12 works except that it will not zero out the outs until another out is entered. That is after 3 outs in the first the next batter in the 2nd hits a single the outs will still read 3 until someone records an out then it will read 1.
 
Upvote 0
Your code for a double play was overwriting the formula in M5 delete the last line line
Code:
Sub DP_Click()Worksheets("Score").Range("X2").Copy
    ActiveSheet.Paste
    Application.CutCopyMode = False
    
    'The below line is overwriting the formula in M5 delete it.
    'Range("M5").Value = Range("M5").Value + 2
    
End Sub

The formula I posted in post 12 works except that it will not zero out the outs until another out is entered. That is after 3 outs in the first the next batter in the 2nd hits a single the outs will still read 3 until someone records an out then it will read 1.

The most part of it works except when an inning is started, I click on walk and it shows 3 outs. It looks like all of the hit's cause the counter go to 3 outs.
 
Upvote 0
To get it to reset on change of inning this formula will only count the current inning. To get this to work the formula needs to know the current inning I used an x above the inning. Your VBA can be modified to move the x after 3 outs.
Code:
=IF(COUNTA(F13:T21),COUNTIF(OFFSET(F13,0,MATCH("x",F11:T11,0)-1,9,1),R2)+COUNTIF(OFFSET(F13,0,MATCH("x",F11:T11,0)-1,9,1),"ground out")+COUNTIF(OFFSET(F13,0,MATCH("x",F11:T11,0)-1,9,1),"fly 
out")+COUNTIF(OFFSET(F13,0,MATCH("x",F11:T11,0)-1,9,1),"foul out")+(COUNTIF(OFFSET(F13,0,MATCH("x",F11:T11,0)-1,9,1),"DP")*2)+(COUNTIF(OFFSET(F13,0,MATCH("x",F11:T11,0)-1,9,1),"TP")*3),0)



Book1
FGHIJKLMNOPQRST
11x
121st2nd3rd4th5th6th7th8th9th10th11th12th13th14th15th
Score
 
Upvote 0
To get it to reset on change of inning this formula will only count the current inning. To get this to work the formula needs to know the current inning I used an x above the inning. Your VBA can be modified to move the x after 3 outs.
Code:
=IF(COUNTA(F13:T21),COUNTIF(OFFSET(F13,0,MATCH("x",F11:T11,0)-1,9,1),R2)+COUNTIF(OFFSET(F13,0,MATCH("x",F11:T11,0)-1,9,1),"ground out")+COUNTIF(OFFSET(F13,0,MATCH("x",F11:T11,0)-1,9,1),"fly 
out")+COUNTIF(OFFSET(F13,0,MATCH("x",F11:T11,0)-1,9,1),"foul out")+(COUNTIF(OFFSET(F13,0,MATCH("x",F11:T11,0)-1,9,1),"DP")*2)+(COUNTIF(OFFSET(F13,0,MATCH("x",F11:T11,0)-1,9,1),"TP")*3),0)


FGHIJKLMNOPQRST
11x
121st2nd3rd4th5th6th7th8th9th10th11th12th13th14th15th

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Score

Not quite sure Im following. Just replace my code in M5 with yours? I did that and it tells me there's a typo somewhere.
 
Upvote 0
If you do not put an x above the current inning the formula will give a N/A error since it is looking for the X.
 
Upvote 0
I copied it into the M5 cell but it only took it as text. The = sign is there with no spaces before it. Not sure whats going on.
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,691
Members
448,978
Latest member
rrauni

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top