ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Countif range contains part of a value (https://www.excelbanter.com/excel-worksheet-functions/229706-countif-range-contains-part-value.html)

antwaan

Countif range contains part of a value
 
I have a range of cells in column A. The values may range from:
10041, 10041B to 10041PEM

I need a formula to count the number of "41" that occurs. Please help!


Jacob Skaria

Countif range contains part of a value
 
=COUNTIF(A:A,"*41*")

If this post helps click Yes
---------------
Jacob Skaria


"antwaan" wrote:

I have a range of cells in column A. The values may range from:
10041, 10041B to 10041PEM

I need a formula to count the number of "41" that occurs. Please help!


Glenn

Countif range contains part of a value
 
antwaan wrote:
I have a range of cells in column A. The values may range from:
10041, 10041B to 10041PEM

I need a formula to count the number of "41" that occurs. Please help!



Any "41", like "10412" and "14102PEM"? What about "14141B"...is that counted
once or twice?

Or are you looking for only where "41" are the 4th and 5th characters in the cell?

antwaan

Countif range contains part of a value
 
Thanks Jacob, but this formula does not produce accurate results.

"Jacob Skaria" wrote:

=COUNTIF(A:A,"*41*")

If this post helps click Yes
---------------
Jacob Skaria


"antwaan" wrote:

I have a range of cells in column A. The values may range from:
10041, 10041B to 10041PEM

I need a formula to count the number of "41" that occurs. Please help!


antwaan

Countif range contains part of a value
 
"41" will always be the 4th & 5th characters in the cell.


"Glenn" wrote:

antwaan wrote:
I have a range of cells in column A. The values may range from:
10041, 10041B to 10041PEM

I need a formula to count the number of "41" that occurs. Please help!



Any "41", like "10412" and "14102PEM"? What about "14141B"...is that counted
once or twice?

Or are you looking for only where "41" are the 4th and 5th characters in the cell?


Jacob Skaria

Countif range contains part of a value
 
Some of the cells may be in number format.

Suppose A is the column you have with this data..
in Col B enter the formula B1 = TEXT(A1,"?")
and then try

=COUNTIF(B:B,"*41*")


If this post helps click Yes
---------------
Jacob Skaria


"antwaan" wrote:

Thanks Jacob, but this formula does not produce accurate results.

"Jacob Skaria" wrote:

=COUNTIF(A:A,"*41*")

If this post helps click Yes
---------------
Jacob Skaria


"antwaan" wrote:

I have a range of cells in column A. The values may range from:
10041, 10041B to 10041PEM

I need a formula to count the number of "41" that occurs. Please help!


Glenn

Countif range contains part of a value
 
Try this:

=SUMPRODUCT(--(MID(A1:A100,4,2)="41"))

antwaan wrote:
"41" will always be the 4th & 5th characters in the cell.


"Glenn" wrote:

antwaan wrote:
I have a range of cells in column A. The values may range from:
10041, 10041B to 10041PEM

I need a formula to count the number of "41" that occurs. Please help!


Any "41", like "10412" and "14102PEM"? What about "14141B"...is that counted
once or twice?

Or are you looking for only where "41" are the 4th and 5th characters in the cell?


Jacob Skaria

Countif range contains part of a value
 
Oops
B1 = T(A1). Copy that down...which will convert the values to text and then
apply CountIF

If this post helps click Yes
---------------
Jacob Skaria


"antwaan" wrote:

Thanks Jacob, but this formula does not produce accurate results.

"Jacob Skaria" wrote:

=COUNTIF(A:A,"*41*")

If this post helps click Yes
---------------
Jacob Skaria


"antwaan" wrote:

I have a range of cells in column A. The values may range from:
10041, 10041B to 10041PEM

I need a formula to count the number of "41" that occurs. Please help!


antwaan

Countif range contains part of a value
 
=TEXT(A1,"?") worked, =T(A1) didn't.

Thank you Jacob!


"Jacob Skaria" wrote:

Some of the cells may be in number format.

Suppose A is the column you have with this data..
in Col B enter the formula B1 = TEXT(A1,"?")
and then try

=COUNTIF(B:B,"*41*")


If this post helps click Yes
---------------
Jacob Skaria


"antwaan" wrote:

Thanks Jacob, but this formula does not produce accurate results.

"Jacob Skaria" wrote:

=COUNTIF(A:A,"*41*")

If this post helps click Yes
---------------
Jacob Skaria


"antwaan" wrote:

I have a range of cells in column A. The values may range from:
10041, 10041B to 10041PEM

I need a formula to count the number of "41" that occurs. Please help!


antwaan

Countif range contains part of a value
 
Glenn - this worked great. Now I don't have to add in another column to
convert to text; plus it's more accurate.
Thanks again.


"Glenn" wrote:

Try this:

=SUMPRODUCT(--(MID(A1:A100,4,2)="41"))

antwaan wrote:
"41" will always be the 4th & 5th characters in the cell.


"Glenn" wrote:

antwaan wrote:
I have a range of cells in column A. The values may range from:
10041, 10041B to 10041PEM

I need a formula to count the number of "41" that occurs. Please help!


Any "41", like "10412" and "14102PEM"? What about "14141B"...is that counted
once or twice?

Or are you looking for only where "41" are the 4th and 5th characters in the cell?



Glenn

Countif range contains part of a value
 
Glad I could help.

Your responses here will almost always be more accurate when you provide more
information. Your original request was open to many interpretations and
possible solutions.



antwaan wrote:
Glenn - this worked great. Now I don't have to add in another column to
convert to text; plus it's more accurate.
Thanks again.


"Glenn" wrote:

Try this:

=SUMPRODUCT(--(MID(A1:A100,4,2)="41"))

antwaan wrote:
"41" will always be the 4th & 5th characters in the cell.


"Glenn" wrote:

antwaan wrote:
I have a range of cells in column A. The values may range from:
10041, 10041B to 10041PEM

I need a formula to count the number of "41" that occurs. Please help!

Any "41", like "10412" and "14102PEM"? What about "14141B"...is that counted
once or twice?

Or are you looking for only where "41" are the 4th and 5th characters in the cell?



All times are GMT +1. The time now is 12:12 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com