How not to count blank cells

mrc44

Board Regular
Joined
Aug 12, 2017
Messages
64
I have this formula
Code:
=LEN(B4)-LEN(SUBSTITUTE(B4,",",""))+1
which counts the comma separated values in cells. My problem is the formula counts the blank cells which contains formulas as 1. How can I fix this? thanks.

for example:

if B4 is {1,2,3}, the result will be 3.
if B4 is {25}, the result will be 1.
if B4 is {}, the result will be 1. (which should be 0).
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
ok, thanks. I found solution here.

Code:
[COLOR=#574123][COLOR=#333333][INDENT]=IF(LEN(D8)>0,LEN(D8)-LEN(SUBSTITUTE(D8,",",""))+1,0)[/INDENT]

[/COLOR]


[/COLOR]
[COLOR=#574123][B][RIGHT][/RIGHT]
[/B][/COLOR]
 
Upvote 0

Forum statistics

Threads
1,225,012
Messages
6,182,354
Members
453,108
Latest member
bb43442

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