COUNTIF Formula help

TheyCallMeIke

New Member
Joined
Nov 4, 2010
Messages
34
Hello everybody,

I need some help trying to get this formula to countif, but containing multiple values.

I know its sloppy but my current formula is (and it works):

=COUNTIF(February!K3:K9994,"3")+COUNTIF(February!K3:K9994,"5")+COUNTIF(February!K3:K9994,"9")+COUNTIF(February!K3:K9994,"12")+COUNTIF(February!K3:K9994,"37")+COUNTIF(February!K3:K9994,"39")+COUNTIF(February!K3:K9994,"46")+COUNTIF(February!K3:K9994,"47")+COUNTIF(February!K3:K9994,"54")+COUNTIF(February!K3:K9994,"73")+COUNTIF(February!K3:K9994,"74")+COUNTIF(February!K3:K9994,"75")+COUNTIF(February!K3:K9994,"76")+COUNTIF(February!K3:K9994,"77")+COUNTIF(February!K3:K9994,"78")

So what that is doing is telling the cell to add up everything on the February sheet in the K column containing the values 3, 9, 5, 12, etc. and add them all together. Again, i'm a newb and it's sloppy, but it works.

Now what I need to do, is not only have it add all of those up like above, but somehow add in for the formula to ALSO only countif cell D range or column D is populated with "HMO"

the ending result is that the specific cell with this formula will countif all of the rows containing those numbers in the K column listed above, but also only if they contain the text HMO in column D. so it has to meet both criteria.

Can anyone help me with this? If my explanation isnt clear (i'm terrible at explaining things) just let me know and i'll try to do better.

thanks so much for anyone that can help me with this.
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Hello everybody,

I need some help trying to get this formula to countif, but containing multiple values.

I know its sloppy but my current formula is (and it works):



So what that is doing is telling the cell to add up everything on the February sheet in the K column containing the values 3, 9, 5, 12, etc. and add them all together. Again, i'm a newb and it's sloppy, but it works.

Now what I need to do, is not only have it add all of those up like above, but somehow add in for the formula to ALSO only countif cell D range or column D is populated with "HMO"

the ending result is that the specific cell with this formula will countif all of the rows containing those numbers in the K column listed above, but also only if they contain the text HMO in column D. so it has to meet both criteria.

Can anyone help me with this? If my explanation isnt clear (i'm terrible at explaining things) just let me know and i'll try to do better.

thanks so much for anyone that can help me with this.
Use cells to hold all those criteria:

Book1
AB
23HMO
35_
49_
512_
637_
739_
846_
947_
1054_
1173_
1274_
1375_
1476_
1577_
1678_
Sheet1

Then the formula is:

=SUMPRODUCT(--(ISNUMBER(MATCH(February!K3:K9994,A2:A16,0))),--(February!D3:D9994=B2))
 
Upvote 0
How about...

=SUMPRODUCT(--(February!D3:D9994="HMO"),--(ISNUMBER(MATCH(February!K3:K9994,{3,5,9,12,37,39,46,47,54,73,74,75,76,77,78},0))))
 
Upvote 0
To include the extra condition you can use COUNTIFS (with an "S") if you have Excel 2007 or later, i.e.

=SUM(COUNTIFS(February!K3:K9994,{3,5,9,12,37,39,46,47,54,73,74,75,76,77,78},February!D3:D9994,"HMO"))
 
Last edited:
Upvote 0
TheyCallMeIke,

How about:


Excel Workbook
KLM
3316
45
59
612
737
839
946
1047
1154
1273
1374
1475
1576
1677
1778
18
19
20
213
22
23
February
 
Upvote 0
Beaten to it, normally entered:
Code:
=SUMPRODUCT((February!K3:K9994={3,5,9,12,37,39,46,47,54,73,74,75,76,77,78})*(February!D3:D9994="HMO"))
 
Upvote 0
How about...

=SUMPRODUCT(--(February!D3:D9994="HMO"),--(ISNUMBER(MATCH(February!K3:K9994,{3,5,9,12,37,39,46,47,54,73,74,75,76,77,78},0))))


This one worked perfectly.

The others may have as well I just went down the line in order!

THANK YOU ALL SO MUCH, you are amazing people.

Always so helpful.:) I'd buy you all a beer if I could!!

Cheers!!
 
Upvote 0

Forum statistics

Threads
1,224,542
Messages
6,179,421
Members
452,913
Latest member
JWD210

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