hi
i have a data like this in a string.
K,L,M,N,O
I want to count the total values that are separated by comma and store it in a variable i.e. it has to return 5..
Please help me if you can
Thanks,
bujji
hi
i have a data like this in a string.
K,L,M,N,O
I want to count the total values that are separated by comma and store it in a variable i.e. it has to return 5..
Please help me if you can
Thanks,
bujji
Hi
One way, could be this.
=IF(LEN(TRIM(A1))>0,LEN(TRIM(A1))-LEN(SUBSTITUTE(TRIM(A1)," ",""))+1,0)
Regards
Fotis.
-This is my Greek whisper to Europe.
--Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.
Advanced Excel Techniques: http://excelxor.com/
--KISS(Keep it simple Stupid)
--Bring them back.
---See about Acropolis of Athens.
--Visit Greece.
=len(a1)-len(substitute(a1,",",""))+1
"Unless otherwise stated all my comments are directed at OP"
Mojito connoisseur and now happily retired
where does code go ?
look here
how to insert code
how to enter array formula
why use -- in sumproduct
recommended reading
wiki Mojito
how to say no convincingly
most important thing you need
Martin Wilson: SPV
and RSMBC
bujji1305,
If this string is in cell A1:
K,L,M,N,O
Then in cell B1, try:
=IF(RIGHT(A1,1)<>",",LEN(A1)-LEN(SUBSTITUTE(A1,",",""))+1,LEN(A1)-LEN(SUBSTITUTE(A1,",","")))
Have a great day,
Stan
Windows 10, Excel 2007, on a PC.
If you are satisfied with the solution(s) provided, please mark your thread as Solved by clicking EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.
Hi Fotis1991,martindwilson,stanleydgromjr ....... no code is working for me....
can you be more specific what doesn't work ?
Actually i have a .csv file from which the data is imported to excel report... From .csv, i need to split the semi colon separated values in a column by giving condition at report generator form i gave condition as K,L,M:K i.e., i need to split data in K to k,L,M
so i get this value in a string a in my code as
a=instr(1,splitcol,",")
now i get a value as K,L,M so i want 'a' count to be stored in a value...
Pls, upload a sample workbook
bujji1305,
Can we have a workbook/worksheet with the strings in column A, and in column B the results you are looking for manually inputed by you?
To attach your workbook, scroll down and click on the Go Advanced button, then scroll down and click on the Manage Attachments button.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks