#1   Report Post  
Posted to microsoft.public.excel.misc
dan dan is offline
external usenet poster
 
Posts: 38
Default Character count

Is there a formula that returns a count of a specified character?
For example:
Cell(A1) = I:\1stFolder\2ndFolder\3thFolder\4thFolder\5thFold er\abc.xls
Answer would be 6 for "\"

And also a formula that returns a folder name between 2 consecutive "\"


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,311
Default Character count

To get a count of the number of times "\" appears:
=LEN(A1)-LEN(SUBSTITUTE(A1,"\",""))

Which folder name do you want? There are 5 folders.

Regards,
Paul




--

"dan" wrote in message
news:97QKi.4076$WT2.3028@trndny05...
Is there a formula that returns a count of a specified character?
For example:
Cell(A1) = I:\1stFolder\2ndFolder\3thFolder\4thFolder\5thFold er\abc.xls
Answer would be 6 for "\"

And also a formula that returns a folder name between 2 consecutive "\"



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Character count

say a1 has the full text and a2 has the character to be counted:

=LEN(A1)-LEN(SUBSTITUTE(A1,A2,""))

For the data between \
use Text to Columns
--
Gary''s Student - gsnu200747


"dan" wrote:

Is there a formula that returns a count of a specified character?
For example:
Cell(A1) = I:\1stFolder\2ndFolder\3thFolder\4thFolder\5thFold er\abc.xls
Answer would be 6 for "\"

And also a formula that returns a folder name between 2 consecutive "\"



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,593
Default Character count

Try DataText To Columns for the second part.

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"dan" wrote in message
news:97QKi.4076$WT2.3028@trndny05...
Is there a formula that returns a count of a specified character?
For example:
Cell(A1) = I:\1stFolder\2ndFolder\3thFolder\4thFolder\5thFold er\abc.xls
Answer would be 6 for "\"

And also a formula that returns a folder name between 2 consecutive "\"



  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,202
Default Character count

Is there a formula that returns a count of a specified character?
For example:
Cell(A1) = I:\1stFolder\2ndFolder\3thFolder\4thFolder\5thFold er\abc.xls
Answer would be 6 for "\"

And also a formula that returns a folder name between 2 consecutive "\"


For the second question, if you really need a formula (that is, if Bob's
TextToColumn suggestion isn't usable for some reason), then give this a
try...

=IF(AND(B10,B1<LEN(A1)-LEN(SUBSTITUTE(A1,"\",""))),MID(LEFT(A1,FIND("*",S UBSTITUTE(A1&"\","\","*",B1+1))-1),1+FIND("*",SUBSTITUTE(A1,"\","*",B1)),260),"")

It assumes the folder number you are looking for (1 for the the first
folder, 2 for the second one, etc.) is in B1. The formula returns the empty
string if zero, a negative value or a value that would take you up to (or
beyond) the file name itself.

Rick



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 281
Default Character count

Hi,

If you are looking to count repetitions of a word (more than one character)
for example the word "Folder" in your text string then you should change the
Gary's formula to:

=(LEN(A1)-LEN(SUBSTITUTE(A1,A2,"")))/LEN(A2)

Thanks,
--
Farhad Hodjat


"Gary''s Student" wrote:

say a1 has the full text and a2 has the character to be counted:

=LEN(A1)-LEN(SUBSTITUTE(A1,A2,""))

For the data between \
use Text to Columns
--
Gary''s Student - gsnu200747


"dan" wrote:

Is there a formula that returns a count of a specified character?
For example:
Cell(A1) = I:\1stFolder\2ndFolder\3thFolder\4thFolder\5thFold er\abc.xls
Answer would be 6 for "\"

And also a formula that returns a folder name between 2 consecutive "\"



  #7   Report Post  
Posted to microsoft.public.excel.misc
dan dan is offline
external usenet poster
 
Posts: 38
Default Character count

Hi Rick,
Your formula is very useful to me. Thank you very much.

"Rick Rothstein (MVP - VB)" wrote in
message ...
Is there a formula that returns a count of a specified character?
For example:
Cell(A1) = I:\1stFolder\2ndFolder\3thFolder\4thFolder\5thFold er\abc.xls
Answer would be 6 for "\"

And also a formula that returns a folder name between 2 consecutive "\"


For the second question, if you really need a formula (that is, if Bob's
TextToColumn suggestion isn't usable for some reason), then give this a
try...

=IF(AND(B10,B1<LEN(A1)-LEN(SUBSTITUTE(A1,"\",""))),MID(LEFT(A1,FIND("*",S UBSTITUTE(A1&"\","\","*",B1+1))-1),1+FIND("*",SUBSTITUTE(A1,"\","*",B1)),260),"")

It assumes the folder number you are looking for (1 for the the first
folder, 2 for the second one, etc.) is in B1. The formula returns the
empty string if zero, a negative value or a value that would take you up
to (or beyond) the file name itself.

Rick



  #8   Report Post  
Posted to microsoft.public.excel.misc
dan dan is offline
external usenet poster
 
Posts: 38
Default Character count

Thank you, Farhad,
I like its thoroughness

"Farhad" wrote in message
...
Hi,

If you are looking to count repetitions of a word (more than one
character)
for example the word "Folder" in your text string then you should change
the
Gary's formula to:

=(LEN(A1)-LEN(SUBSTITUTE(A1,A2,"")))/LEN(A2)

Thanks,
--
Farhad Hodjat


"Gary''s Student" wrote:

say a1 has the full text and a2 has the character to be counted:

=LEN(A1)-LEN(SUBSTITUTE(A1,A2,""))

For the data between \
use Text to Columns
--
Gary''s Student - gsnu200747


"dan" wrote:

Is there a formula that returns a count of a specified character?
For example:
Cell(A1) = I:\1stFolder\2ndFolder\3thFolder\4thFolder\5thFold er\abc.xls
Answer would be 6 for "\"

And also a formula that returns a folder name between 2 consecutive "\"





  #9   Report Post  
Posted to microsoft.public.excel.misc
dan dan is offline
external usenet poster
 
Posts: 38
Default Character count

Very nice, Thank you

"PCLIVE" wrote in message
...
To get a count of the number of times "\" appears:
=LEN(A1)-LEN(SUBSTITUTE(A1,"\",""))

Which folder name do you want? There are 5 folders.

Regards,
Paul




--

"dan" wrote in message
news:97QKi.4076$WT2.3028@trndny05...
Is there a formula that returns a count of a specified character?
For example:
Cell(A1) = I:\1stFolder\2ndFolder\3thFolder\4thFolder\5thFold er\abc.xls
Answer would be 6 for "\"

And also a formula that returns a folder name between 2 consecutive "\"





  #10   Report Post  
Posted to microsoft.public.excel.misc
dan dan is offline
external usenet poster
 
Posts: 38
Default Character count

Thank you

"Gary''s Student" wrote in message
...
say a1 has the full text and a2 has the character to be counted:

=LEN(A1)-LEN(SUBSTITUTE(A1,A2,""))

For the data between \
use Text to Columns
--
Gary''s Student - gsnu200747


"dan" wrote:

Is there a formula that returns a count of a specified character?
For example:
Cell(A1) = I:\1stFolder\2ndFolder\3thFolder\4thFolder\5thFold er\abc.xls
Answer would be 6 for "\"

And also a formula that returns a folder name between 2 consecutive "\"





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
character count Mariappan New Users to Excel 3 September 6th 07 02:18 PM
Character count within a cell Mhunter Setting up and Configuration of Excel 2 December 1st 06 10:37 AM
How do i set up a character count for a specified cell?? Steve-O Excel Discussion (Misc queries) 1 October 25th 06 05:41 PM
how can I count (countif) the character: * Mousquito Excel Worksheet Functions 1 October 9th 06 12:20 PM
Character Count Hardip Excel Worksheet Functions 5 January 10th 06 01:46 PM


All times are GMT +1. The time now is 04:23 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"