ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   A cell contains "1,2,3"; and I want to count those sep. by comma (https://www.excelbanter.com/excel-discussion-misc-queries/38714-cell-contains-%221-2-3%22%3B-i-want-count-those-sep-comma.html)

Mahendra

A cell contains "1,2,3"; and I want to count those sep. by comma
 
I have three columns. Column A contains a number, column B contains bunch of
numbers separated by comma corresponding to the number in column A. In the
column C, I want to count the numbers in col. B separated by comma. Example:

Column A Column B Column C
1200 2,3,4,8 4 (i.e.
there are four numbers

in column B)

JE McGimpsey

One possibility:

=IF(B1="","",LEN(B1)-LEN(SUBSTITUTE(B1,",",""))+1)

In article ,
"Mahendra" wrote:

I have three columns. Column A contains a number, column B contains bunch of
numbers separated by comma corresponding to the number in column A. In the
column C, I want to count the numbers in col. B separated by comma. Example:

Column A Column B Column C
1200 2,3,4,8 4 (i.e.
there are four numbers

in column B)


Bernie Deitrick

Mahendra,

In C1, to count the items in B1

=IF(B1<"",LEN(B1)-LEN(SUBSTITUTE(B1,",",""))+1,0)

HTH,
Bernie
MS Excel MVP


"Mahendra" wrote in message
...
I have three columns. Column A contains a number, column B contains bunch of
numbers separated by comma corresponding to the number in column A. In the
column C, I want to count the numbers in col. B separated by comma. Example:

Column A Column B Column C
1200 2,3,4,8 4 (i.e.
there are four numbers

in column B)





All times are GMT +1. The time now is 10:42 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com