# Count number of value repeated.

#### lazylilsnoop

##### New Member
Hi,

 Type Cost Z 100 Z 100 Z,Y 200 Z,P 100 Z,Y,P 100

<tbody>
</tbody>

this is simplified version of what I'm trying to search, my list goes until 2000 cells

anyway, i need to figure out how many "Z" appears in TYPE
I used "countif(A2:A5, "Z") but it return the value 3.
if i want it to return 5, what should i input?

The other question is if i would like to sum of all the value that has Type Z in it, what is the formula?
"=sumif(A2:A5,"Z",B2:B5)" couldn't do the trick

thanks alot

### Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

#### vogel997

##### Active Member
Try this

=countif(A1:A5, "Z*")

=SUMIF(A1:A5,"z*",B1:B5)

Last edited:

#### lazylilsnoop

##### New Member
Awesome! by adding the " * " at the back of the word really does the magic.

but what if I were to type Z in a cell,A20 (just so that i can search the whole sheet by changing the Type I need to search)?
e.g "=countif(A1:A5,A20)"

#### vogel997

##### Active Member
=COUNTIF(A1:A5,A20&"*") this should work

#### lazylilsnoop

##### New Member
This formula totally works!!!

I added "*"& infront and back....
so everything works perfectly now!! thanks

you're welcome

Replies
5
Views
639
Replies
14
Views
429
Replies
12
Views
677
Replies
17
Views
5K
Replies
1
Views
130

1,171,466
Messages
5,875,669
Members
433,147
Latest member
Nav05

### 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.

### Which adblocker are you using?

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

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