ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Countif based of partial cell contents (https://www.excelbanter.com/excel-discussion-misc-queries/236495-countif-based-partial-cell-contents.html)

Tony S.[_2_]

Countif based of partial cell contents
 
II need help modifying a formula.
=COUNTIF($D$6:$D$1006,H1)
This returns the count for the value in H1 fine, but I need to modify it so
it will still return the correct number if there are spaces or characters
before or after the value in H1.

Example:
If H1 contains "BBDC3245---" or a space exists before or after " BBDC3245 "
,I want to still count all the occurrences of that base number in col D6to
D1006. I guess I need kind of a wild card search?

--
Tony S.


T. Valko

Countif based of partial cell contents
 
Try this:

H1 = BBDC3245 (no spaces)

=COUNTIF(D6:D1006,"*"&H1&"*")

--
Biff
Microsoft Excel MVP


"Tony S." wrote in message
...
II need help modifying a formula.
=COUNTIF($D$6:$D$1006,H1)
This returns the count for the value in H1 fine, but I need to modify it
so
it will still return the correct number if there are spaces or characters
before or after the value in H1.

Example:
If H1 contains "BBDC3245---" or a space exists before or after " BBDC3245
"
,I want to still count all the occurrences of that base number in col D6to
D1006. I guess I need kind of a wild card search?

--
Tony S.




Tony S.[_2_]

Countif based of partial cell contents
 
That works great for no spaces. Thanks for the help.
--
Tony S.


"T. Valko" wrote:

Try this:

H1 = BBDC3245 (no spaces)

=COUNTIF(D6:D1006,"*"&H1&"*")

--
Biff
Microsoft Excel MVP


"Tony S." wrote in message
...
II need help modifying a formula.
=COUNTIF($D$6:$D$1006,H1)
This returns the count for the value in H1 fine, but I need to modify it
so
it will still return the correct number if there are spaces or characters
before or after the value in H1.

Example:
If H1 contains "BBDC3245---" or a space exists before or after " BBDC3245
"
,I want to still count all the occurrences of that base number in col D6to
D1006. I guess I need kind of a wild card search?

--
Tony S.





T. Valko

Countif based of partial cell contents
 
You're welcome. Thanks for the feedback!

--
Biff
Microsoft Excel MVP


"Tony S." wrote in message
...
That works great for no spaces. Thanks for the help.
--
Tony S.


"T. Valko" wrote:

Try this:

H1 = BBDC3245 (no spaces)

=COUNTIF(D6:D1006,"*"&H1&"*")

--
Biff
Microsoft Excel MVP


"Tony S." wrote in message
...
II need help modifying a formula.
=COUNTIF($D$6:$D$1006,H1)
This returns the count for the value in H1 fine, but I need to modify
it
so
it will still return the correct number if there are spaces or
characters
before or after the value in H1.

Example:
If H1 contains "BBDC3245---" or a space exists before or after "
BBDC3245
"
,I want to still count all the occurrences of that base number in col
D6to
D1006. I guess I need kind of a wild card search?

--
Tony S.








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

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