Formula to count after filtering data

redspanna

Well-known Member
Joined
Jul 27, 2005
Messages
1,602
Office Version
  1. 365
Platform
  1. Windows
I have a sheet that contains several thousand rows of data that I will filter to get what I need.

Basically I would like a formula or maybe code that will count the number of times the number '1' is shown through the filtered rows in column K IF the date value through the filtered data in column A is equal to a date that is shown in cell A1 of sheet2.

So If date in A1 sheet2 is 30Aug14, count how many times the number 1 is shown in the same filtered data through column K

Hope this makes sense and thanks in advance
 
Hello Redspanna
Assuming that your wanting to count the instances where the dates match when the string "dep" appears in ANY cell in Col C:

=SUMIF(A:A,Sheet2!$A$1,K:K)* (COUNTIF(C:C, "dep" )>0)

This means that Excel will count all the matching dates, provided that there is at least one instance of the string "dep" (anywhere) in Col C.

HTH
 
Last edited:
Upvote 0

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Hello Redspanna
Assuming that your wanting to count the instances where the dates match when the string "dep" appears in ANY cell in Col C:

=SUMIF(A:A,Sheet2!$A$1,K:K)* (COUNTIF(C:C, "dep" )>0)

This means that Excel will count all the matching dates, provided that there is at least one instance of the string "dep" (anywhere) in Col C.

HTH

This will multiply a conditional sum result with a conditional count result. Is this what is wanted?
 
Upvote 0
This will multiply a conditional sum result with a conditional count result. Is this what is wanted?

Hello Aladin - How r u ?
In answer to your question, Im not sure as the explanation is a little ambiguous.

In post #7 the OP is happy with the SUMIF that sums the contents of col K where the date in the same row in Col A matches the date in Sheet2!A1
However, the OP asks for the following amendment:
"I also only want column K counted if the date is matched AND column C has 'dep' in any cell".
I interprete this as meaning col K will not be counted unless column C has 'dep' in any cell in the column. Based on this, the formula gives the correct result. Because of the ambiguity, I have asked for
clarification, and when this is provided it may change the solution.
 
Upvote 0

Forum statistics

Threads
1,215,403
Messages
6,124,710
Members
449,182
Latest member
mrlanc20

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