Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help w/ project. Counting upper and lower case characters in a cell.

Here's the task I'm trying to complete:

Take text from a cell.
Count all uppercase letters.
Count all lower case letters.

I've figured out how to count the total letters excluding spaces using
the LEN and SUBSTITUTE commands, but I'm stuck on how to count how many
uppercase and lower case letters there are. Can anyone point me in the
right direction?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Help w/ project. Counting upper and lower case characters in a cell.

This is a fast function to count upper case characters.
You can work out for yourself how to do lower case.


Function CountUppers(ByVal strString As String) As Long

Dim aByte() As Byte
Dim i As Long

aByte() = strString

For i = 0 To UBound(aByte) Step 2
If aByte(i) < 91 Then
If aByte(i) 64 Then
CountUppers = CountUppers + 1
End If
End If
Next

End Function


Sub test()

MsgBox CountUppers(Cells(1))

End Sub


RBS


wrote in message
oups.com...
Here's the task I'm trying to complete:

Take text from a cell.
Count all uppercase letters.
Count all lower case letters.

I've figured out how to count the total letters excluding spaces using
the LEN and SUBSTITUTE commands, but I'm stuck on how to count how many
uppercase and lower case letters there are. Can anyone point me in the
right direction?


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
Changing multiple cell text from lower case to upper case Patti Excel Discussion (Misc queries) 2 January 4th 08 08:35 PM
Changing upper case characters to upper/lower Richard Zignego Excel Discussion (Misc queries) 1 December 17th 07 10:09 PM
Counting Upper and Lower case chars in a Cell Mad Axeman Excel Discussion (Misc queries) 7 July 31st 07 05:31 PM
Changing file in all upper case to upper and lower case Sagit Excel Discussion (Misc queries) 15 May 30th 07 06:08 AM
Change from mixed caps and upper lower to all upper lower case Fish''s Mermaid Excel Worksheet Functions 3 October 13th 06 02:15 PM


All times are GMT +1. The time now is 04:49 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"