Excel Productivity Guide

Useful Excel Tips | Keyboard Shortcuts | VBA Codes

**Download this Free E-Book **to take your excel skills to a whole next level using some smart Excel tactics.

Worth $20, Absolutely Free

Two days back I wrote about how you can use OR logic in SUMIFS and SUMIF. And today, I want to show, that you can also use the same OR logic and multiple conditions in COUNIFS and COUNIF.

Even you can create dynamic criteria for OR logic in COUNIFS and COUNIF.

**Have you ever faced a situation where you need to count more than one value from a single column or a range?**

**If yes, then using a COUNIFS or a COUNIF with an OR logic is the best solution to this problem.**

Normally, if you go with COUNTIF you can just count cells by specifying a single condition and if you go with COUNIFS you can specify more than one condition but it uses AND logic to count values.

That means you can’t use these functions to count more than a value from a single column or a range.

**So today, in this post you will learn a simple but power way to applying OR condition in COUNIFS and COUNIF.**

Have a look at below data where you have a list of people and their favorite social media platform. Download this sample file from here to follow along.

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.

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

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

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 you need to split this formula into three parts.

- First of all, you have used two different criteria in this formula by using array concept.
- And after that, you have used COUNTIFS to look for these two values.
- In the end, you 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 COUNTIFS but the in COUNTIF formula will work in the same way.

Two days back, when I explained about using OR in SUMIF/SUMIFS, Shay asked me that how can he use dynamic values instead of using hardcore values in this formula.

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

- The first is, instead of using curly brackets you need to use a named range (best way is to use an excel table) of your value.
- 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:

{=SUM(COUNTIFS(B2:B51,Named_Range))}

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? Or have any other method to use instead.

Tell me in the comment section, I would love to hear from you.

- harsh shahi
- Puneet Gogia
- harsh shahi
- Puneet Gogia

- mano Amiri