ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Number of Characters in a Cell (https://www.excelbanter.com/excel-programming/425881-number-characters-cell.html)

Martin

Number of Characters in a Cell
 
I want to count the number of Characters in a cell. I had thought of using a
Do While loop and the Mid() Function to count, but I don't know what the last
character is?

Anybody got any ideas?

Rick Rothstein

Number of Characters in a Cell
 
How about using the Len function?

NumberOfCharacters = Len(Range("A1").Value)

--
Rick (MVP - Excel)


"Martin" wrote in message
...
I want to count the number of Characters in a cell. I had thought of using
a
Do While loop and the Mid() Function to count, but I don't know what the
last
character is?

Anybody got any ideas?



Martin

Number of Characters in a Cell
 
Oh dear, of course that would be the way to go, completely forgot that
function!!!

"Rick Rothstein" wrote:

How about using the Len function?

NumberOfCharacters = Len(Range("A1").Value)

--
Rick (MVP - Excel)


"Martin" wrote in message
...
I want to count the number of Characters in a cell. I had thought of using
a
Do While loop and the Mid() Function to count, but I don't know what the
last
character is?

Anybody got any ideas?




Jacob Skaria

Number of Characters in a Cell
 
Dear Martin

TRIM the value if imported from an external source and use the LEN function
as below.

LEN(Trim(Range("A" & intRow)))

If this post helps click Yes
--------------
Jacob Skaria


"Martin" wrote:

I want to count the number of Characters in a cell. I had thought of using a
Do While loop and the Mid() Function to count, but I don't know what the last
character is?

Anybody got any ideas?



All times are GMT +1. The time now is 01:10 PM.

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