countif cell back to 0

jarhead58

Active Member
Joined
Sep 21, 2017
Messages
367
Office Version
  1. 2021
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

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
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
x

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]11[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]12[/TD]
[TD="align: center"]1st[/TD]
[TD="align: center"]2nd[/TD]
[TD="align: center"]3rd[/TD]
[TD="align: center"]4th[/TD]
[TD="align: center"]5th[/TD]
[TD="align: center"]6th[/TD]
[TD="align: center"]7th[/TD]
[TD="align: center"]8th[/TD]
[TD="align: center"]9th[/TD]
[TD="align: center"]10th[/TD]
[TD="align: center"]11th[/TD]
[TD="align: center"]12th[/TD]
[TD="align: center"]13th[/TD]
[TD="align: center"]14th[/TD]
[TD="align: center"]15th[/TD]

</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,224,844
Messages
6,181,294
Members
453,030
Latest member
PG626

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