Counting $ Signs

T

teddyb777

I have a column that contains text and within that text appears "$". I need in cell B1 to count how many times there is a $ in A1 and then fill down Column B. I tried =countif(A1:A1, "$") but it doesn't seem to work. I then want to use this count as a criteria to apply functions to certain cells.
Thanks.
 
A

Andy B

Hi

If you want the formula to count the $ wherever it appears, one option is to
use the * wildcard:
=COUNTIF(A1:A1,"*$*")

--
Andy.


teddyb777 said:
I have a column that contains text and within that text appears "$". I
need in cell B1 to count how many times there is a $ in A1 and then fill
down Column B. I tried =countif(A1:A1, "$") but it doesn't seem to work. I
then want to use this count as a criteria to apply functions to certain
cells.
 
A

Ashish Mathur

Hi,

Try this. Assuming your text is in cell B4, array enter (Ctrl+Shift+Enter) the following formula in cell D4

SUM(IF(MID($B$4,ROW(1:20),1)="$",1,0))

I have assumed that length of the string is 20, you may adjust the number in the formula, there is no restriction

Regards,
 
H

Harlan Grove

Ashish Mathur said:
Try this. . . .

SUM(IF(MID($B$4,ROW(1:20),1)="$",1,0))

I have assumed that length of the string is 20, you may adjust
the number in the formula, there is no restriction

The more common answer in this newsgroup is

=LEN($B$4)-LEN(SUBSTITUTE($B$4,"$",""))

which doesn't require array entry, doesn't require guessing the length of
B4, and works with text of any permissible length.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top