How to use OR Logic in COUNTIF/COUNIFS in Excel


Have a look at below data where you have a list of people and their favorite social media platform.

data to use or logic in countif and countifs

Now, from this list of 50 people, you need to count how many people like “Facebook” and “Twitter”.

If you want to use COUNIF then insert below formula in a cell and hit enter.


countif formula to use or logic in countif and countifs

And, if you want to use COUNIFS then insert below formula in a cell and hit enter.


countifs formula to use or logic in countif and countifs

With both of the above formulas, you will get 25 in the result which is the count of both Facebook (17) + Twitter (8) combined.

How it works

As I mentioned earlier, COUNTIFS uses AND logic and on the other hand, in COUNIF you can only specify one value to count.

To understand the application of OR with these functions you need to split this formula into three parts.

how countif or formula works
  1. First of all, we have used two different criteria in this formula by using array concept.
  2. And after that, we have used COUNTIFS to look for these two values.
  3. In the end, we have enclosed the entire formula in SUM function to get the joint count of both of the values.

Here I have explained this concept in COUNTIF but the in COUNTIFS formula will work in the same way.

Dynamic OR Condition

use or logic in countif and countifs shay comment

And for this, you need to do just two little amendments in your formula.

  1. The first is, instead of using curly brackets you need to use a named range (best way is to use table) of your values.
  2. And after that, you need to enter this formula by using Ctrl + Shift + Enter as a proper array formula.

So, now your formula will be:


dynamic range to use or logic in countif and countifs

Sample File


Using an OR logic in COUNIF/COUNIFS can increase its power and save you for writing long formulas.

And, using dynamic criteria is super awesome. You can change values anytime you want, without changing the formula.

I hope you found this formula tips useful and it will help to become more efficient in your work.

So, what you think about this one.

Have you tried this anytime before this?

Share your views with me in the comment section, I’d love to hear from you. And, please don’t forget to share this tip with your friends.

Content Protection by


  1. BC Dizier 16 Oct, 18 at 11:43 pm - Reply

    How would you do this inVBA?

  2. Arif Rana 16 Oct, 18 at 8:30 am - Reply

    I don’t know how but you do guess what we have in mind to look for the solutions which we require most. Plus your tips guides me to explore new avenues regarding Excel problem solving methods. Please do keep up with the good work.

  3. Najib Beg 4 Nov, 17 at 10:35 am - Reply

    I am enjoying weekends by applying your excel tips which I received by email, it’s very useful and apply it in my daily at work and remind functions of excel. I appreciate your work, God bless you always.

    • Puneet Gogia 4 Nov, 17 at 11:48 am - Reply

      Thanks, Najib. Your words are blessings.

  4. Daryl Fagala 31 Oct, 17 at 4:36 pm - Reply

    Good post! But the article’s title and conclusion, as well as a lot of verbiage in between, are about COUNTIF/COUNTIFS “OR”. I can’t find “OR” in any of the example formulas. Am I missing something?

    • Puneet Gogia 1 Nov, 17 at 5:18 am - Reply

      ha ha ha You gave me a laugh.
      I think I missed something while explaining, I’ll try to improve. But the thing is it’s not about combing COUNTIF with OR but adding a OR effect in it.

      • Daryl Fagala 1 Nov, 17 at 2:43 pm - Reply

        Thanks for the reply. I’m looking forward to learning more about COUNTIF…OR. Also, thanks for the many email newsletters that I’ve found extremely useful. I’ve been an Excel developer for 19-plus years and I continue to be amazed by the things you do with formulas. Keep ’em coming!

        • Puneet Gogia 4 Nov, 17 at 11:48 am - Reply

          You’re Welcome.

  5. mano Amiri 18 Apr, 17 at 7:41 am - Reply

    Thank you for the sample that you have noticed.

    • Puneet Gogia 1 Nov, 17 at 5:18 am - Reply

      You’re Welcome

  6. harsh shahi 24 Mar, 17 at 4:21 am - Reply

    Hello Ponit Sir, the way you explain Excel, it is a very good way. This makes us understand easily. I am very grateful to you that you know the excellence of Excel in such a nice and easy way.

    • Puneet Gogia 25 Mar, 17 at 10:16 am - Reply

      Thank you for these kind words

      • harsh shahi 25 Mar, 17 at 11:12 am - Reply

        punnet sir,
        pls try to post offset function of excel.

        • Puneet Gogia 6 Apr, 17 at 5:51 am - Reply


Leave A Comment