Counting Text using Countifs with Multiple Criteria filters and data contains Blanks/Null

Benders

Board Regular
Joined
Mar 18, 2014
Messages
75
Hi

I am unable to count using using Countifs with Multiple Criteria filters and data contains Blanks/Null. Can someone please help?

Fruits</SPAN>Vendors</SPAN>Quality</SPAN>Fairtrade</SPAN>
Apples</SPAN>TE</SPAN>Low</SPAN>Yes</SPAN>
Mangoes</SPAN>SA</SPAN>Medium</SPAN>No</SPAN>Item</SPAN>Dropdown Selections</SPAN>
Grapes</SPAN>WA</SPAN>High</SPAN>Yes</SPAN>Fruits</SPAN>Mangoes</SPAN>
Apples</SPAN>MO</SPAN>Low</SPAN>No</SPAN>Vendors</SPAN>
Mangoes</SPAN> Medium</SPAN>Yes</SPAN>Quality</SPAN>Medium</SPAN>
Grapes</SPAN>TE</SPAN>High</SPAN>No</SPAN>Fairtrade</SPAN>Yes</SPAN>
Apples</SPAN>SA</SPAN>Low</SPAN>Yes</SPAN>
Mangoes</SPAN>WA</SPAN>Medium</SPAN>No</SPAN>Count = 0</SPAN>
Grapes</SPAN>MO</SPAN>High</SPAN>
Apples</SPAN> Low</SPAN>
Mangoes</SPAN>TE</SPAN>Medium</SPAN> Formula in Cell above</SPAN>
Grapes</SPAN>SA</SPAN>High</SPAN>No</SPAN>=COUNTIFS(A2:A16,G4,B2:B16,G5,C2:C16,G6,D2:D16,G7)</SPAN>
Apples</SPAN>WA</SPAN>Low</SPAN>Yes</SPAN>
Mangoes</SPAN>MO</SPAN>Medium</SPAN>No</SPAN>
Grapes</SPAN> High</SPAN>Yes</SPAN>

<TBODY>
</TBODY><COLGROUP><COL span=2><COL span=2><COL><COL><COL><COL><COL></COLGROUP>
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Your coutifs formula doesn't like the blank cells. I suggest you put soemthing in Like "-". The formula worked for me then.

Alternatively you insert a coolumn at A and put a 1 in each cell and use sum(if insted of countifs(. Sum(if will work with blank cells however the syntax is different.

Assuming you've put the new column A in ( you can hide it if you don't want to see it later)


=sum(if(B2:B16=H20,If(C2:C16=H21,if(D2:D16=H22,if(E2:E16=H23,A2:A16)))))
This is an array formula so you must press Ctrl Shift and Enter together when enerting it, not just Enter.

Good Luck

<COLGROUP><COL style="WIDTH: 492pt; mso-width-source: userset; mso-width-alt: 23990" width=656><TBODY>
</TBODY>
 
Upvote 0
Sorry but if you remove all except one from the Drop Down selections (e.g. just keep Fruits=Mangoes), the formula does not work and I am referring to the Array formula. The idea is the that the user can selection any combination from the Drop down and the Count should change based on the selections. The guy I am making this for hates Pivots and hence trying to use this technique.
 
Upvote 0
When you say its not working what do you mean ? What is the formula cell saying. I tried it in my spreadsheet and it returned zero because there are not any records that have just Mangoes on the same row. When I made a record with Mangoes and the other colmns blank, it worked ok.

If you get #Value in the formula cell it's because you didn't press Ctrl Shift and Enter together to enter the formula, you must do this.

let me know what you're getting.
 
Upvote 0
If your expecting the formula to just count the rows with Mangoes irrespective of data in any other column ? It won't. It's checking for the conditions you specified. To do that you need to set up separate formulas that check for the one condition.
 
Upvote 0
I actually do want the formula to just count the rows with Mangoes irrespective of data in any other column. The count is based on the Drop Down choices made. If the user chooses only one drop down option and chooses Mangoes then the count of all Mangoes should appear, If now the user chooses the second drop down to select a vendor then the formula should reflect likewise and so on.
 
Upvote 0
That particular formula won't do that unless all the other columns are blank. You're asking it to test for four conditions and return a value. But what you want to do is say check for these conditions but ignore them when I want you to ? How would it know when and when not to ignore them.

Do 4 more cells with the condition just for Fruit, vendor, Quality or Fairtrade. If you PM me your email address I'll send you my file and you can have a look at that see if it will give you what you want.

The question then of course is what you do for A particula fruit and vendor or Vendor and fairtrade etc.

For that Kind of flexibilty you will need a Pivot table.
 
Upvote 0
I think I may have solved this. I used DCOUNTA and had to make a few modifications to the way the data is presented. Apologies for the format in which I am presenting this.

1</SPAN>B</SPAN>C</SPAN>D</SPAN>E</SPAN>F</SPAN>G</SPAN>H</SPAN>I</SPAN>J</SPAN>K</SPAN>
2</SPAN>Fruits</SPAN>Vendors</SPAN>Quality</SPAN>Fairtrade</SPAN>
3</SPAN>Apples</SPAN>TE</SPAN>Low</SPAN>Yes</SPAN>
4</SPAN>Mangoes</SPAN>SA</SPAN>Medium</SPAN>No</SPAN>Item</SPAN>Fruits</SPAN>Vendors</SPAN>Quality</SPAN>Fairtrade</SPAN>
5</SPAN>Grapes</SPAN>WA</SPAN>High</SPAN>Yes</SPAN>Selection</SPAN>Apples</SPAN>
6</SPAN>Apples</SPAN>MO</SPAN>Low</SPAN>No</SPAN>
7</SPAN>Mangoes</SPAN> Medium</SPAN>Yes</SPAN>
8</SPAN>Grapes</SPAN>TE</SPAN>High</SPAN>No</SPAN>
9</SPAN>Apples</SPAN>SA</SPAN>Low</SPAN>Yes</SPAN>
10</SPAN>Mangoes</SPAN>WA</SPAN>No</SPAN>Count</SPAN>
11</SPAN>Grapes</SPAN>MO</SPAN>Yes</SPAN>5</SPAN>
12</SPAN>Apples</SPAN>MO</SPAN>Yes</SPAN>
13</SPAN>Mangoes</SPAN>TE</SPAN>Yes</SPAN>Formula above is given below</SPAN>
14</SPAN>Grapes</SPAN>SA</SPAN>No</SPAN>=DCOUNTA($B$2:$E$17,H4,H4:K5)</SPAN>
15</SPAN>Apples</SPAN>WA</SPAN>Yes</SPAN>
16</SPAN>Mangoes</SPAN>MO</SPAN>No</SPAN>
17</SPAN>Grapes</SPAN>TE</SPAN>High</SPAN>Yes</SPAN>

<TBODY>
</TBODY>
 
Upvote 0
Hi,

That's great. Well done. They say necessity is the mother of invention. If it works for you all well and good, thats what the forums all about.

Of course now we can all shre in this new (to me) formula. Not seen it before.

thanks.
 
Upvote 0

Forum statistics

Threads
1,213,543
Messages
6,114,243
Members
448,555
Latest member
RobertJones1986

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