

Counting Wins and Losses

by Allen Wyatt
(last updated October 15, 2015)


Graham has, in Excel, created a matrix of player names for his league. Cells B2:H2 contain the names of the players, as do cells A3:A9. At each intersection in the matrix, Graham places a "W" or "L" to indicate whether the match-up resulted in a win or loss for the player in each row. If a player plays another person more than once, then a cell contains a "W" or "L" for each game. Graham was wondering what formula could be used, starting in column I, to indicate the number or wins and losses for each player.

There are a number of ways you can get the desired information. One is to use this type of formula:


This formula calculates the number of non-L characters in row 3—in other words, the number of wins. It does this by concatenating the contents of B3:H3, and then using the SUBSTITUTE function to remove all the Ls. This leaves the Ws, which are counted by the LEN function. You could also use the CONCATENATE function, in the following manner, for the same result:


To calculate the number of losses, simply replace "L" in each formula with "W".

You can also use an array formula, which allows you to specify a range of cells to examine, rather than needing to specify every single cell:


This array formula, entered by pressing Shift+Ctrl+Enter, returns the number of wins (W characters) in the range B3:H3.

Finally, you can use a user-defined function to return the occurrences of a specific character within a given range. The following macro will do the trick:

Function CharNums(r, chr) As Integer
    Dim c As Range
    Dim strX As String
    Dim J As Integer

    CharNums = 0
    For Each c In r.Cells
        strX = c.Value
        For J = 1 To Len(strX)
            If Mid(strX, J, 1) = chr Then CharNums = CharNums + 1
        Next J
    Next c
End Function

To use the function, you would us a formula like this in your worksheet:


The function returns the number of uppercase W characters in the range. All other characters (including lowercase w characters) are ignored. To count losses, simply substitute L for W in the formula.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (3049) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Counting Wins and Losses.

Author Bio

Allen Wyatt



Creating a Printer Pool


Discover More

Self-Deleting Macros

Macros are very powerful, but you may not want them to always be available to a user. Here are some ways you can limit their ...

Discover More

Magnifying Only the Current Cell


Discover More



Extracting First and Last Words


Discover More

Incrementing References by Multiples when Copying Formulas


Discover More

Solving Simultaneous Equations


Discover More


View most recent newsletter.

Comments for this tip:


What is 9 + 8?

2016-01-12 14:00:55


I have a spreadsheet of football standings, Column A lists team names and columns B-K are weeks 1-10 which can contain either W (win), L (loss), or B (Bye week) for each team. Column L is a Totals column for which I want the records displayed in W-L format (e.g. 5-2 for five wins and two losses, ignoring Bye weeks in tallying obviously). How would I do this with a formula? Thanks in advance!

2015-03-16 21:45:45


I need a formula to calculate wins and loses. I have a column called record. I would like the record to change after every w or l. column e is called result and has either a w or a l in it. column g is called record. I would like record to be 1-0, and to change with every w or l. e3:e29.

2012-04-30 14:00:02


The simple COUNTIF formulas by ProClave won't work. Note that the first paragraph of the tip says "If a player plays another person more than once, then a cell contains a "W" or "L" for each game."

This means that a single cell could have multiple Ws and Ls in them. Thus, a cell could have in it "WWW" or "WLWWL" or any other permutation.

If a cell contains ONLY a "W" or an "L", then the shorter COUNTIF formulas would work fine.

2012-04-30 13:53:24




Newest Tips



View the most recent newsletter.

Links and Sharing