Home » excel » excel – Match names in column A and B, then count occurrences in C

# excel – Match names in column A and B, then count occurrences in C

Posted by: admin May 14, 2020 Leave a comment

Questions:

We have a scoring spreadsheet which tracks games played and the winner of each match. We have the following columns

• column A (name1)
• column B (vs)
• column C (name2)
• column D (winner name)

I have used

``````=SUMPRODUCT((A:A="name1")*(C:C="name2")+(A:A="name2")*(C:C="name1"))
``````

to count how many games this particular pairing have played, simply because as the games are entered by different people names are in either column.

Now I need to find a way to count the amount wins from the games these two have played, obviously the formula above is redundant for this.

So in effect, match from column A and C `name1` and `name2` and count how many `name1` exists in column D.

How to&Answers:

It should be sufficient to count how many times Name1 exists in column D with Name2 in A or C so try either

`=COUNTIFS(D:D,"Name1",A:A,"Name2")+COUNTIFS(D:D,"Name1",C:C,"Name2")`

or you can use SUMPRODUCT like this

`=SUMPRODUCT((D:D="Name1")*((A:A="Name2")+(C:C="Name2")))`

The first one is longer but more efficient