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.")


,A comma is present…
aNo comma found.
,A comma is present…
1,000No comma found.
<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> </tbody>
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
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
Unfortunately, the comma IS present due to number formatting - is there a way to use VBA "Instr"?
 
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,214,923
Messages
6,122,286
Members
449,076
Latest member
kenyanscott

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