If a comma is found

  • Thread starter Thread starter David P.
  • Start date Start date
Another one:

=IF(COUNT(FIND(",",A1)),.....

Note that this doesn't work on numbers using a number comma format (10,000)
 
Assumes that A1 contains text:
=IF(ISERROR(FIND(",",A1)),"comma not found","comma found")

Joerg
 
Here is another approach...

=IF(LEN(A1)=LEN(SUBSTITUTE(A1,",","")),"No comma","There's a comma")
 
I like this one best... one function call. Let's remove the comparison just
to shorten it up a bit...

=IF(COUNTIF(A1,"*,*"),"found","not found")
 
I find using the comparison self-documenting.

Rick said:
I like this one best... one function call. Let's remove the comparison just
to shorten it up a bit...

=IF(COUNTIF(A1,"*,*"),"found","not found")
 
That is true enough (but I would guess doing introduces an extra, albeit
very quick, calculation to the formula).

--
Rick (MVP - Excel)


Dave Peterson said:
I find using the comparison self-documenting.
 
I think it makes the formula easier to understand -- especially for the posters
who are asking this type of question.

And it may make it easier to use the function in different formulas.



Rick said:
That is true enough (but I would guess doing introduces an extra, albeit
very quick, calculation to the formula).
 

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

Back
Top