Count matches of football scores using =SUM(IF(J3:J23=J37:J57,1,0))

Shmerty

New Member
Joined
Oct 30, 2013
Messages
36
Hi everyone.

Id expect the above formula (placed in AA34) to return the number 2. But it doesn't, it returns 19! Way off!

I think I'm close, and as you will see from all the different formula combinations, I have been trying everything!

Hopefully someone can help me out.

Many thanks,
Shmerty
WorldCup2014.jpg
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
The reason it is doing this is because empty cells are considered as having 0, so it is counting all of the blanks between 3 and 23, 16 of them, and then couting the blanks in 37 through 57, and treating those as matches
 
Upvote 0
The reason it is doing this is because empty cells are considered as having 0, so it is counting all of the blanks between 3 and 23, 16 of them, and then couting the blanks in 37 through 57, and treating those as matches

Thanks for your response. I thought it was something like that so I did try:

=SUM(IF(J3:J23<>""=J37:J57<>"",1,0))

But that didn't work. In programming I'd extract only valid numbers, push them into an array, and use a loop to compare each index of the array. But I find Excel a lot more difficult:mad:
 
Upvote 0
Try this

=SUMPRODUCT(1*(J3:J23=J37:J57))-COUNTIF(J37:J57,"")

Hi Jett,

This has gotten me closer! Thank you for it. However, it's still not ideal as:

1. it sees 0 and "" as a match.
2. the top part of the SS is live, and I will be filling in the scores as the games are played. The rest of the SS are the predicted scores from those participating in my wee competition. So because no games have been played yet, all players are starting on -11.

This has turned into something very tricky, yet when I thought of the idea I thought it sounded simple to implement. I couldn't have been more wrong!

Thanks for your help though, really appreciate it.

Liam
 
Upvote 0
Try

=SUMPRODUCT((J3:J23=J37:J57)*(J3:J23<>"")*(J37:J57<>""))
 
Upvote 0
Try

=SUMPRODUCT((J3:J23=J37:J57)*(J3:J23<>"")*(J37:J57<>""))

This works perfect! I have had to extend it to include another 5 columns and I think there might be a neater solution compared to what I have done?
Code:
=SUMPRODUCT(($J$3:$J$23=J37:J57)*($J$3:$J$23<>"")*(J37:J57<>""))+SUMPRODUCT(($L$3:$L$23=L37:L57)*($L$3:$L$23<>"")*(L37:L57<>""))+SUMPRODUCT(($O$3:$O$33=$O$37:$O$67)*($O$3:$O$33<>"")*(O37:O67<>""))+SUMPRODUCT(($Q$3:$Q$33=$Q$37:$Q$67)*($Q$3:$Q$33<>"")*(Q37:Q67<>""))+SUMPRODUCT(($T$3:$T$29=$T$37:$T$63)*($T$3:$T$29<>"")*(T37:T63<>""))+SUMPRODUCT(($V$3:$V$29=$V$37:$V$63)*($V$3:$V$29<>"")*(V37:V63<>""))
 
Last edited:
Upvote 0
Try this one

=SUMPRODUCT((J3:T33=J37:T67)*(ISNUMBER(J3:T33))*(ISNUMBER(J37:T67))*(ISNUMBER(MATCH(COLUMN(J3:T33),{10,12,15,17,20,22},0))))
 
Upvote 0
Try this one

=SUMPRODUCT((J3:T33=J37:T67)*(ISNUMBER(J3:T33))*(ISNUMBER(J37:T67))*(ISNUMBER(MATCH(COLUMN(J3:T33),{10,12,15,17,20,22},0))))

Had to change the T's to V's but it worked perfect and much simpler code for me to understand. It's great all the support I've had from this forum. That been said..

I never ask for help before I try something myself (I'm a teacher and expect the same from my pupils), but I am struggling with the formula for the other 2 columns
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,551
Members
449,088
Latest member
davidcom

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