Countifs Functions not adding up.

joshuadalrymple

New Member
Joined
Sep 22, 2015
Messages
4
Hello,

I have several countifs functions looking at the same data in order to pull totals.

The first equation:

=COUNTIFS(Data!$O:$O, "5 Pack",Data!$L:$L, "Plastic")

Gives me the total of 1000.

=COUNTIFS(Data!$O:$O, "5 Pack",Data!$L:$L, "Glass")

Gives me the total of 43.

The function =SUM(B3:B4)*5 gives me a grand total of 5215.

Now, I also need to know the flavors that were sold in the 5 packs, not just the size. So I am using this function.

=COUNTIFS(Data!$O:$O,"Build Your Own 5 Pack",Data!$G:$G,H66)+COUNTIFS(Data!$O:$O,"5 Pack",Data!$H:$H, H66)+COUNTIFS(Data!$O:$O,"5 Pack",Data!$I:$I,H66)+COUNTIFS(Data!$O:$O,"5 Pack",Data!$J:$J,H66)+COUNTIFS(Data!$O:$O,"5 Pack",Data!$K:$K,H66)

As I am sure you can tell, in the data worksheet, I have 5 columns where the name of the flavor would be populated, and a column where the product name, in this case 5 pack is populated. This function is intended to count an occurrence of a flavor in each of the 5 columns, only if it is a 5 pack, and give me the sum of the counts of all 5 columns.

I have 86 Flavors and 86 cells with this function. I then sum their answers using =SUM(I2:I86) and get 5205.

Clearly something is wrong, and I have spent more time than I am willing to admit trying to figure it out. I have manually counted and 5215 is the correct answer. However, I have also manually counted each flavor and I cannot find an error there either.

If someone could please lend me a hand that would be greatly appreciated.

 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
You say there are 86-flavors...
You are adding 85-flavors...

Yeah, I saw that. I have 85 flavors. Thanks.

I was able to figure it out. I was not accounting for orders with errors in which no flavor was selected. By adding another line item with the following function, I got it working.

=COUNTIFS(Data!$O:$O,"Build Your Own 5 Pack",Data!$G:$G,"")+COUNTIFS(Data!$O:$O,"Build Your Own 5 Pack",Data!$H:$H, "")+COUNTIFS(Data!$O:$O,"Build Your Own 5 Pack",Data!$I:$I,"")+COUNTIFS(Data!$O:$O,"Build Your Own 5 Pack",Data!$J:$J,"")+COUNTIFS(Data!$O:$O,"Build Your Own 5 Pack",Data!$K:$K,"")

Thanks!
 
Upvote 0

Forum statistics

Threads
1,216,045
Messages
6,128,477
Members
449,455
Latest member
jesski

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