counting...

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi...

In cell A1 I invite the user to type a message. I need a function in Cell B1
that will count the number of characters used (including spaces) and then
alert the user that they have exceeded 150.

Sounds easy I know but I can't make it happen.

Humbly yours

Gordon.
 
Why not use Data->Validation->Text Length... Set up your error message and
Bobs your uncle...

HTH
 
Hi,

I believe this will do the trick. In B1 you should write the following:

=if(len(A1)>150;"More than 150 chars";"Less than 150 chars")
The "len(...)" function gives you the length of the values inserted in one
cell.

Cheers,

Nuno
 
Gordon,

The following function should do the trick

Function exceed(rng, length)
If Len(rng.Value) > length Then
exceed = "You have exceeded the desired length in cell " & rng.Address
Else
exceed = Len(rng.Value)
End If


End Function


The function requires two variables. The range of the cell whose length is
desired, and the length that should not be exceeded.

http://HelpExcel.com
 
Neither macros or worksheet functions operate in any useful way while you
are editing a cell. The best you could get would be to use Data=>Validation
and limit the length or alert after the fact,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top