How to count character and space?

  • Thread starter Thread starter Rocky Lam
  • Start date Start date
R

Rocky Lam

How do I create a macro or script to calculate how characters and space in
each cell? I import many worksheet to my other program but only import
maxinum of total 30 characters and space per cell. I hate to have manually
count each cell.

Thanks

Rocky
 
Do you really need a macro?

You could use

=LEN(A1)

to get the length of the text in cell A1.
 
Can you show me the step how to do this. I use the autosum function key and
I don't get the result.

Thanks

Rocky
 
instead of using Autosum, type

=LEN(A1)

directly in the formula bar of the cell you want to contain the formula.
Change A1 to whichever cell you are trying to find the length of.


Copy down the column for as many rows as necessary.
 
JEs given you your answer, but just in case it helps you can also manipulate
these strings in Excel. If you are using it to find the cells with more
than 30 characters and then editing the cells to reduce them then this can
be done quite easily.

Assuming you had a piece of text in cell A1 that was 40 characters long,
then if in cell B1 you put the formula =LEFT(A1,30) you will get only the
first 30 characters returned.

Another option might be to select all the cells in a column, do data / text
to columns / fixed width and then set a break at the 30th character. this
will truncate your entire range of cells to a max of 30 characters.
 
Back
Top