Check Winning Numbers with COUNTIF Function

Today, we’ll see a little magic from the COUNTIF function – it can do the work of seven formulas in one!

The COUNTIF function can check a range of cells, and see if it contains a specific value. For example, type your lucky number in cell D2, and use a COUNTIF formula to see if that number is found in the list of winning numbers in cells I2:N2.



The number, 26, is found once in the range I2:N2, so the COUNTIF result is 1. Your lucky number is a winner!

Check Multiple Numbers

What if we have multiple lucky numbers to check – not just one number? In the next screen shot, there are six numbers to check, entered in cells A2:F2. The winning numbers are still listed in cells I2:N2.

We could create a similar COUNTIF formula, to check each cell, to see if it is a winner. Here is the formula in B5 – the column references in I2:N2 are locked, so that reference won’t change when the formula is copied across to cell G5.



In cell H5, use the SUM function to find the total number of cells that match the winning numbers.


That shows a total of 1, so only one of the six lucky numbers is a winner.

Get the Total Count in One Step

Instead of creating 6 COUNTIF formulas, and a SUM, we could use an array-entered COUNTIF formula, to get the answer in one step.

In the next screen shot, the following formula is array-entered in cell B5 – press Ctrl + Shift + Enter, instead of just pressing Enter.



If you change the lucky number in cell E2 to 22, instead of 7, the number of winners changes to 2, instead of 1. I’ve added conditional formatting in cells B2:G2, to colour the winning numbers yellow.


With cells B2:G2 selected, the conditional formatting formula is the same as our earlier formula:



Check Losing Teams

The same technique works with text too, and the range that’s being checked can be vertical, instead of horizontal.

In the next screen shot, 6 people have picked the teams that they think will win the four games being played today. When each game is finished, the losing team’s name is entered in column H.

A SUM/COUNTIF array formula calculates how many losing teams each person picked. So far, 3 games are finished, and it’s looking good for Al. He hasn’t picked any losing teams yet!

Here is the formula array-entered in cell F2 (Ctrl + Shift + Enter), and copied down to cell F8.



Excel Dashboard Course Recommendation

For a limited time, Mynda Treacy from My Online training Hub is opening her Excel Dashboard Course, and if you sign up by 8 pm Pacific time on October 24th, you can get the course for 20% off.

The course is video based, delivered online and is available 24/7. You’ll receive comprehensive workbooks and sample dashboards to keep, and there’s even an option to download the videos.

I’ve been through this course, and highly recommend it. The previous classes were very successful, and you can read the glowing reviews from the students, who loved all the techniques that they learned in the course, and are using them to impress their colleagues.

Click here to find out the details, read the student comments, and watch the ‘behind the scenes’ video that shows you what you’ll receive as a member. Remember, if you sign up by October 24th, you can get the dashboard course for 20% off.

Bonus: If you sign up for Mynda’s course through one of my links, I’ll send you a copy of my new Excel add-in — Contextures Excel Tools — when it’s ready next month. (If you signed up for one of Mynda’s earlier courses through my link, and you’d like a copy of the new add-in, please send me an email.)

Excel Dashboard Course