excelmatchcountif

Is there a simple formula to count how many times a combination of two columns appears in excel?


I am trying to quickly count a competition in which teams play each other 2 times maximum.

Round Date Field Time Home Away
R1 14/04/2025 F1 19:00 Apples Oranges
R1 14/04/2025 F2 19:00 Pears Grapes
R1 14/04/2025 F3 19:00 Lemons Pumpkins
R2 28/04/2025 F1 19:00 Oranges Apples
R2 28/04/2025 F2 19:00 Pears Pumpkins
R2 28/04/2025 F3 19:00 Lemons Grapes

This is a small sample as I have about 600 lines I need to trawl through. I have looked at Countifs and Match, but can't seem to find the right formula.

Ideally I want to locate and it "ping" a result number if two columns match, even if they are not in the same columns as previous, ( example above, row 2 and row 5 would be a match)


Solution

  • Assuming @Excellor is correct in their assumption of what you want (and of course that makes sense - it is still a good idea to be more specific in your question though, and add data as text and not just as an image), and assuming the data you shared is in columns A:E and on rows 2:7 (and the header on row 1), then you could put this formula in cell F2 (and copy it down):

    =IF(D2 < E2, D2 & "," & E2, E2 & "," & D2)
    

    And this in G2 (and copy it down):

    =COUNTIF(F:F, F2)
    

    The result would be something like:

    A B C D E F G
    Round 1 14/04/2025 F1 Apples Oranges Apples,Oranges 2
    Round 1 14/04/2025 F2 Pears Grapes Grapes,Pears 1
    Round 1 14/04/2025 F3 Lemons Pumpkins Lemons,Pumpkins 1
    Round 2 28/04/2025 F1 Oranges Apples Apples,Oranges 2
    Round 2 28/04/2025 F2 Pears Pumpkins Pears,Pumpkins 1
    Round 2 28/04/2025 F3 Lemons Grapes Grapes,Lemons 1