Counting Formula

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I was wondering if there was anyway to set up a formula to count the number of numbers in a cell that are separated by commas. For example, Cell A1 has a formula that will count Cell A2 that as the following (1,2,3,4,5,6,7,8,9,10). The result in Cell A1 should be 10 for the number of variables in the cell.
 
=LEN(A2)-LEN(SUBSTITUTE(A2,",",""))+1

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 00/02/03

----------------------------------------------------------------------------
It's easier to beg forgiveness than ask permission :-)
----------------------------------------------------------------------------



Steven011 said:
I was wondering if there was anyway to set up a formula to count the number of
numbers in a cell that are separated by commas. For example, Cell A1 has a
formula that will count Cell A2 that as the following (1,2,3,4,5,6,7,8,9,10).
The result in Cell A1 should be 10 for the number of variables in the cell.
 
Steven,

This may do what your looking for:
=LEN(A1)-LEN(SUBSTITUTE(A1,",",""))+1

essentially it counts the number of commas "," and adds 1

Dan E

Steven011 said:
I was wondering if there was anyway to set up a formula to count the number of numbers in a cell that are separated by commas.
For example, Cell A1 has a formula that will count Cell A2 that as the following (1,2,3,4,5,6,7,8,9,10). The result in Cell A1
should be 10 for the number of variables in the cell.
 
I will give it a try. Thanks so much. This will cut my work time in half
 

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

Back
Top