Detect a comma in a text string

BillTony

Board Regular
Joined
May 3, 2017
Messages
70
I need to examine a content string and determine if there is a comma present.

Seems like the easiest thing in the world, but I'm really stumped at the moment.

I will add the formula I'm currently using in the code window, along with my results.

It's the cell containing "1,000" that's giving me the problem...

Thanks in advance!

Rich (BB code):
=IF(COUNTIF(A1,",")>0,"A comma is present…","No comma found.")


[TABLE="width: 253"]
 <colgroup><col width="150" style="width: 113pt; mso-width-source: userset; mso-width-alt: 5485;"> <col width="187" style="width: 140pt; mso-width-source: userset; mso-width-alt: 6838;"> <tbody>[TR]
  [TD="width: 150, bgcolor: transparent"],[/TD]
  [TD="width: 187, bgcolor: transparent"]A comma is  present…[/TD]
 [/TR]
 [TR]
  [TD="bgcolor: transparent"]a[/TD]
  [TD="bgcolor: transparent"]No comma found.[/TD]
 [/TR]
 [TR]
  [TD="bgcolor: transparent"],[/TD]
  [TD="bgcolor: transparent"]A comma is present…[/TD]
 [/TR]
 [TR]
  [TD="bgcolor: transparent"]1,000[/TD]
  [TD="bgcolor: transparent"]No comma found.
[/TD]
 [/TR]
</tbody>[/TABLE]
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Assuming the comma is actually in the cell and not the result of number formatting, you could use:

=IF(ISNUMBER(FIND(",",A1)),"A comma is present…","No comma found.")
 
Upvote 0
Hi,

So since the "comma" for 1,000 does Not Actually exist, but is visible Only due to Cell formatting (Number using comma as thousand separator), are we then safe to assume Any number 1000 or higher Will have a comma?

If so:


Book1
AB
1,A comma is present
2aNo comma found.
3,A comma is present
41,000A comma is present
5a,aA comma is present
6999No comma found.
Sheet284
Cell Formulas
RangeFormula
B1=IF(OR(COUNTIF(A1,"*,*"),AND(ISNUMBER(A1),A1>=1000)),"A comma is present…","No comma found.")
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Back
Top