Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.tables
|
|||
|
|||
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
Posted to microsoft.public.word.tables
|
|||
|
|||
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
Posted to microsoft.public.word.tables
|
|||
|
|||
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 | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Text only appears below text box | Microsoft Word Help | |||
Convert to Symbols | Microsoft Word Help | |||
Printing envelopes from large letter file different text in letter | Microsoft Word Help | |||
Outline | Page Layout | |||
textbox to normal text | New Users |