Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.tables
astrologer
 
Posts: n/a
Default count how often a letter appears within text

ROAR for R is equal to 2 . OAR for R is equal to 1. ORR for R is equal to 2.
The totals are R = 5, O = 3 and A = 2 appearances. What formulae can I use
to count how many times a letter appears in a text?

----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.

http://www.microsoft.com/office/comm...ic.word.tables
  #2   Report Post  
Posted to microsoft.public.word.tables
macropod
 
Posts: n/a
Default count how often a letter appears within text

At the most basic level, select the text and use Find/Replace to replace the
character with itself. Word will tell you how many occurrences were
replaced.

Cheers


"astrologer" wrote in message
...
ROAR for R is equal to 2 . OAR for R is equal to 1. ORR for R is equal to

2.
The totals are R = 5, O = 3 and A = 2 appearances. What formulae can I

use
to count how many times a letter appears in a text?



  #3   Report Post  
Posted to microsoft.public.word.tables
Klaus Linke
 
Posts: n/a
Default count how often a letter appears within text

"macropod" wrote:
At the most basic level, select the text and use Find/Replace to replace
the character with itself. Word will tell you how many occurrences were
replaced.



If you want to get more sophisticated, you'd need a macro. The one below
should do the trick, and append a table with the results at the end of the
document.

If you need help with macros, see
http://word.mvps.org/FAQs/MacrosVBA/CreateAMacro.htm

Regards,
Klaus


Sub CodesFast()
Dim myString, myStringNew, myChar, myCode
Dim strOutput, HexString, myCharCount
myString = ActiveDocument.Content.Text
strOutput = ""
Do
myChar = left$(myString, 1)
myStringNew = Replace(myString, myChar, "", 1, _
Compa=vbBinaryCompare)
myCharCount = Len(myString) - Len(myStringNew)
myCode = AscW(myChar) And &HFFFF&
strOutput = strOutput & (myCode) & vbTab
StatusBar = myCode
HexString = Hex$(myCode)
While Len(HexString) 4
HexString = "0" & HexString
Wend
strOutput = strOutput & "U+" & HexString & vbTab
If myCode 31 Then
strOutput = strOutput & myChar
End If
strOutput = strOutput & vbTab & LTrim(str$(myCharCount))
strOutput = strOutput & vbCr
myString = myStringNew
Loop Until Len(myString) = 0
ActiveDocument.Content.Select
Selection.Collapse Direction:=wdCollapseEnd
Selection.Range.InsertParagraphBefore
Selection.TypeText Text:=" "
Selection.Expand Unit:=wdParagraph
With ActiveDocument.Bookmarks
.Add Range:=Selection.Range, Name:="Codes"
.DefaultSorting = wdSortByName
.ShowHidden = False
End With
Selection.Collapse Direction:=wdCollapseStart
Selection.TypeText strOutput
Selection.GoTo What:=wdGoToBookmark, Name:="Codes"
Selection.ConvertToTable Separator:=wdSeparateByTabs
Selection.Sort ExcludeHeader:=False, FieldNumber:=1, _
SortFieldType:=wdSortFieldNumeric, _
SortOrder:=wdSortOrderAscending
Selection.Rows.ConvertToText Separator:=wdSeparateByTabs
ActiveDocument.Bookmarks("Codes").Delete
End Sub


Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Text only appears below text box bkexum Microsoft Word Help 0 November 1st 05 08:06 PM
Convert to Symbols Omar Menjivar Microsoft Word Help 7 June 27th 05 07:32 PM
Printing envelopes from large letter file different text in letter [email protected] Microsoft Word Help 1 January 30th 05 02:24 AM
Outline Renee Hendershott Page Layout 2 December 25th 04 02:49 PM
textbox to normal text Jack Sons New Users 16 December 5th 04 03:44 PM


All times are GMT +1. The time now is 11:30 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"