Count comma as zero if there is no comma in a cell

Zaimon

New Member
Joined
Sep 10, 2024
Messages
4
Office Version
  1. 365
Platform
  1. Windows
Hi guys,

Here is my formula: =LEN(W3)-LEN(SUBSTITUTE(W3, ",",""))+1

Is there is a way to change the values from 1 to 0 since there is no comma at all in the selected Cell.

Thanks,

1726222798834.png
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Hello, how about:

=IF(OR(ISBLANK(W3),LEN(W3)-LEN(SUBSTITUTE(W3, ",",""))=0),0,LEN(W3)-LEN(SUBSTITUTE(W3, ",",""))+1)
 
Last edited:
Upvote 1
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 1
Another option:
Excel Formula:
=IF(ISNUMBER(SEARCH(",",W3)),LEN(W3)-LEN(SUBSTITUTE(W3, ",",""))+1,0)
 
Upvote 1
Would this work?:

Excel Formula:
=LEN(W3)-LEN(SUBSTITUTE(W3, ",",""))

or

Excel Formula:
=LEN(W3)-LEN(SUBSTITUTE(W3, ",",""))+(W3<>"")
 
Upvote 1
Solution

Forum statistics

Threads
1,224,051
Messages
6,176,086
Members
452,704
Latest member
Michael AA

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