Use countif with multiple criteria

behedwin

Active Member
Joined
Dec 10, 2014
Messages
399
Hey

Id like to know how to use the countif formula with multiple criteria and count just the first letter/number of a cell.

This is an example of what i have

color | number

In the color column i have a mix of colors, there can be dubplicates....
blue
red
blue
red
yellow
blue
yellow
yellow

in the number column i have a mix of differnt type of numbers....
1
1
2a
1a
2b
3
3
3a

so now my question is

I want to present in a cell how many cells in the column number starts with "1" and also have blue color column?

My solution is to use countif with multiple criteria

=COUNTIF(A:A,"Blue","B:B,"1*")

i am using the * symbol to indicate that i want to include rows that just have 1 and also rows 1a or 1bcd or whatever, it starts with 1.

But this does not seem to work very well...
It works in a way, but it skips, if there are values no values with a second letter or number... like it skips cells with just the number 1
And if i remove the * symbol it skips cells that does have a second letter/number.
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
For the countifs to work your numbers will need to be text. Or you could use this:

=SUMPRODUCT(--($A$1:$A$10="Blue"),--(LEFT($B$1:$B$10)="1"))
 
Upvote 0
How about


Excel 2013/2016
ABCD
2blue1red2
3red11
4blue2a
5red1a
6yellow2b
7blue3
8yellow3
9yellow3a
Sheet3
Cell Formulas
RangeFormula
D2=SUMPRODUCT(($A$2:$A$9=C2)*(LEFT($B$2:$B$9)*1=C3))
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

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