Problem with COUNT

C

Cong Nguyen

In cell B1: I wanted to count the number of commas (,) in cell A1

A, B, C, D, F, G, H 2

Please check what's wrong with my COUNT formula, COUNTA(A1,","), somehow the
result is always "2".

Thank you
 
D

Darren Bartrup

You're using the wrong formula.
COUNTA counts cells that are not empty - it doesn't count the occurences of
a character within a single cell.

This formula should do the trick:
=LEN(A1)-LEN(SUBSTITUTE(A1,",",""))

This counts how many characters are in cell A1, it then counts how many
characters are in cell A1 with the , removed.
Take one from the other and you have your result.
 
C

Cong Nguyen

Dear Darren Bartrup,
Thank you very much for the expanation. Now it's clear.
 

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

Top