=SUMIF and =COUNTIF in the same formula

DPChristman

Board Regular
Joined
Sep 4, 2012
Messages
176
Office Version
  1. 365
Platform
  1. Windows
I am looking to create a formula using both the sumf and countif operators.

Example, Column A contains store numbers. Column D contains deposit variances(positive and negative numbers).

However, there is an entry for every store, every day, even if there is no variance

So, what I am try to accomplish is the following:

If the store number is 1, how many times how many times is the variance <>0

The not working version of this formula would be something like =SUMIF(A:A,A2,countif(D:D<>0))

I know that that doesn't work.

To further complicate the formula, we have a tab for each month of the year, so for February's entry, it might look something like this (again, this doesn't work):

=SUMIF('FEB 2016'!A:A,A2,"countif('FEB 2016'!D:D<>))

Is there an easy way to do this?
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
How about this?


Excel 2010
ABCDE
1Store NumberDeposit VariancesStore ## of times variance not 0
21012
311
41-1
521
620
Sheet2
Cell Formulas
RangeFormula
E2=COUNTIFS(A:A,D2,B:B,"<>0")
 
Upvote 0
Thanks. That worked. I kicked myself as soon as a saw =COUNTIFS .
I know about countifs. I just forgot, I guess.

The adjusted version of the formula that I had to use because of the separate tabs is this =COUNTIFS('FEB 2016'!$A:$A,SUMMARY!$A4,'FEB 2016'!$D:$D,"<>0"), though I probably didn't need to reference the tab (SUMMARY) where the formula resides.

Thanks again!
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,398
Latest member
rjsteward

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