Reset calculation when year changes

tigerzen

Board Regular
Joined
Mar 8, 2023
Messages
209
Office Version
  1. 365
Platform
  1. Windows
The tally formula needs to reset when the year changes, the entries in yellow are therefore incorrect, the column on the right contains the correct values. There may be a better way of calculating the tally, if not I'll stick with the COUNTIF function. We require a solution for Excel 2019 please.

Football stats functions.xlsx
ABCDEF
1GameResult YearWin Draw LossShould be
2Game 1D20220-1-0
3Game 2W20221-1-0
4Game 3L20221-1-1
5Game 4L20221-1-2
6Game 5L20221-1-3
7Game 6L20221-1-4
8Game 7L20221-1-5
9Game 8W20222-1-5
10Game 1W20233-1-51-0-0
11Game 2L20233-1-61-0-1
12Game 3L20233-1-71-0-2
13Game 1W20244-1-71-0-0
14Game 2W20245-1-72-0-0
15Game 3W20246-1-73-0-0
Sheet14
Cell Formulas
RangeFormula
D2:D15D2=COUNTIF($B$2:B2,"W")&"-"&COUNTIF($B$2:B2,"D")&"-"&COUNTIF($B$2:B2,"L")
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Use COUNTIFS:

Book1
ABCDEF
1GameResult YearWin Draw LossShould be
2Game 1D20220-1-00-1-0
3Game 2W20221-1-01-1-0
4Game 3L20221-1-11-1-1
5Game 4L20221-1-21-1-2
6Game 5L20221-1-31-1-3
7Game 6L20221-1-41-1-4
8Game 7L20221-1-51-1-5
9Game 8W20222-1-52-1-5
10Game 1W20233-1-51-0-01-0-0
11Game 2L20233-1-61-0-11-0-1
12Game 3L20233-1-71-0-21-0-2
13Game 1W20244-1-71-0-01-0-0
14Game 2W20245-1-72-0-02-0-0
15Game 3W20246-1-73-0-03-0-0
Sheet1
Cell Formulas
RangeFormula
D2:D15D2=COUNTIF($B$2:B2,"W")&"-"&COUNTIF($B$2:B2,"D")&"-"&COUNTIF($B$2:B2,"L")
E2:E15E2=COUNTIFS($C$2:C2,C2,$B$2:B2,"W")&"-"&COUNTIFS($C$2:C2,C2,$B$2:B2,"D")&"-"&COUNTIFS($C$2:C2,C2,$B$2:B2,"L")
 
Upvote 0
Solution
Thanks Phuoc, that is perfect. I'd been mucking around with IF functions trying to make this work when all I had to do was add some more criteria to the COUNTIF function.
 
Upvote 0

Forum statistics

Threads
1,224,822
Messages
6,181,164
Members
453,021
Latest member
Justyna P

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