Count lines of text in word

Show word count

Word counts the number of words in a document while you type. Word also counts pages, paragraphs, lines, and characters.

Your browser does not support video. Install Microsoft Silverlight, Adobe Flash Player, or Internet Explorer 9.

When you need to know how many words, pages, characters, paragraphs, or lines are in a document, check the status bar.


Partial word count

For a partial word count, select the words you want to count. The status bar shows the word count for that selection and for the entire document.

Tip: Find the number of characters, paragraphs, and lines by clicking on the word count in the status bar.
Word count detail

Count the number of characters, lines, and paragraphs

You can view the number of characters, lines, paragraphs, and other information in your Word for Mac, by clicking the word count in the status bar to open the Word Count box. Unless you have selected some text, Word counts all text in the document, as well as the characters, and displays them in the Word Count box as the Statistics.

Word count dialog box

Count the number of words in a part of a document

To count the number of words in only part of your document, select the text you want to count. Then on the Tools menu, click Word Count.

Just like the Word desktop program, Word for the web counts words while you type.

Word Count

If you don’t see the word count at the bottom of the window, make sure you’re in Editing view (click Edit Document > Edit in Word for the web).

Click the word count to switch it off and on.

Word Count Disabled

Maybe you noticed that Word for the web gives you an approximate word count. That’s because it doesn’t count words in areas like text boxes, headers, footers, and SmartArt graphics. If you need an exact count, click Open in Word, and look at the word count at the bottom of the Word document window.

Need more help?

Please Note:
This article is written for users of the following Microsoft Word versions: 97, 2000, 2002, and 2003. If you are using a later version (Word 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Word, click here: Counting Document Lines.

Written by Allen Wyatt (last updated July 23, 2022)
This tip applies to Word 97, 2000, 2002, and 2003


Word provides a tool you can use to return simple statistics about your document. One of the statistics it can provide is the number of lines in your document. In order to see how many lines there are in your document, choose Word Count from the Tools menu. After a short delay (depending on the size of your document and the speed of your computer), Word displays the Word Count dialog box. (See Figure 1.)

Figure 1. The Word Count dialog box.

One of the statistics provided in the Word Count dialog box is Lines. The value returned by Word depends on several things. First, it obviously depends on the formatting of your document. For instance, if you decrease the point size of text within your document, that can affect the line count. Second, the printer driver you are using can affect the number of lines in your document. In both instances, the differences are due to the different ways in which Word «flows» your text in the document. When the point size is smaller, Word can fit more characters on each given line, thereby reducing the overall number of lines required to present the same information. Likewise, using a different printer driver could result in a slightly different rendering of a font. For instance, the same font may appear more «compressed» on one printer than on another. This, again, means different amounts of information per line and a potentially different line count.

Finally, hidden text can affect the line count returned in the Word Count dialog box. If you have the printing of hidden text turned off, Word doesn’t count hidden text in the line count. If you want it to be considered, make sure you configure Word to print hidden text.

WordTips is your source for cost-effective Microsoft Word training.
(Microsoft Word is the most popular word processing software in the world.)
This tip (535) applies to Microsoft Word 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Word (Word 2007 and later) here: Counting Document Lines.

Author Bio

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. Learn more about Allen…

MORE FROM ALLEN

Returning Word to Default Settings

Want to set everything back to a pristine state in Word? Doing so is more involved than you may believe.

Discover More

Inserting Video into Worksheets

You can add all sorts of objects to your workbooks, including video clips. Here’s the pros and cons (along with the …

Discover More

Rejecting Changes in a Document

When a group of people edits a document with Track Changes turned on, it can be tempting for one of the editors to use …

Discover More

На чтение 2 мин Опубликовано 02.10.2015

Статистика документа Word

В Word есть инструмент, который показывает простую статистику документа. Статистика содержит информацию о том, сколько страниц, слов, символов, абзацев и строк содержится в документе. Такая статистика полезна, если при создании документа необходимо ориентироваться на заданные параметры.

Чтобы увидеть статистику документа, откройте его и перейдите на вкладку Рецензирование (Review).

Статистика документа Word

В разделе Правописание (Proofing) нажмите Статистика (Word Count).

Статистика документа Word

Откроется диалоговое окно со статистикой, как показано на картинке в начале этой статьи. Кстати, количество страниц и слов в документе можно также увидеть в строке состояния в самом низу окна Word.

Замечание: Количество страниц отображается в строке состояния только в режимах Разметка страницы (Print Layout) или Черновик (Draft) – эти режимы включаются на вкладке Вид (View).

Статистика документа Word

Если Вы не видите в строке состояния количество страниц и слов в документе, кликните по ней правой кнопкой мыши и в появившемся меню укажите элементы, которые желаете видеть. Кроме этого, Вы можете включить отображение номера строки, в которой в данный момент находится курсор.

Статистика документа Word

Количество строк и страниц в документе может меняться – это зависит от нескольких факторов, таких как величина полей страницы, тип и размер шрифта, интервалы между абзацами и так далее. Например, если Вы уменьшаете размер шрифта, то число строк и страниц в документе также изменится. Разница в количестве строк и страниц может появиться даже из-за незначительных отличий в обработке шрифта разными драйверами печати.

Кроме этого, на количество строк, указанное в отчёте в диалоговом окне Статистика (Word Count), может повлиять скрытый текст. Если в параметрах Word отключена печать скрытого текста, то скрытый текст не будет учтён при подсчёте строк в документе. Если же Вы хотите, чтобы строки скрытого текста тоже были посчитаны, то печать скрытого текста в параметрах Word должна быть включена.

Оцените качество статьи. Нам важно ваше мнение:

Word includes a tool that allows you to view simple statistics about your document. These statistics include how many pages, words, characters, paragraphs, and lines are in your document. This is useful if you have to follow certain guidelines when writing your document.

To view these statistics, open the document in question and click the “Review” tab.

In the “Proofing” section, click “Word Count”.

The “Word Count” dialog box displays, as shown in the image at the beginning of this document. The number of pages and words can also be viewed on the status bar at the bottom of the Word window.

NOTE: The number of pages is only visible on the status bar when you are viewing your document in “Print Layout” view or “Draft” view (using the “View” tab).

If you don’t see the number of pages and words on the status bar, right-click on the status bar and select the items you want to view from the popup menu. Note that you can also view the line number for the line where the cursor is currently located.

The number of lines and pages may vary, depending on several factors, such as the margins in your document, the font and font size, and paragraph spacing, to name a few. For example, if you change to a smaller font size, there will be fewer lines and pages in your document than there would be with a larger font size. Even different printer drivers can result in a slightly different rendering of a font, thereby changing the number of lines and pages in your document.

Hidden text can also affect the line count reported on the “Word Count” dialog box. If the option to print hidden text is turned of, Word doesn’t count hidden text in the line count. If you want hidden text included in the line count, make sure you configure Word to print hidden text.

READ NEXT

  • › How to Count Characters in Word
  • › How to Get Workbook Statistics in Microsoft Excel
  • › How to Get a Paragraph Count for a Specific Paragraph Style in a Word Document
  • › How to Count Characters in Microsoft Excel
  • › How to Check the Word Count in Microsoft Word
  • › This New Google TV Streaming Device Costs Just $20
  • › Google Chrome Is Getting Faster
  • › BLUETTI Slashed Hundreds off Its Best Power Stations for Easter Sale

How-To Geek is where you turn when you want experts to explain technology. Since we launched in 2006, our articles have been read billions of times. Want to know more?

I wanted to count the lines of selected text in MS word document. I come up with code:

Sub Count_Lines()
ActiveDocument.ComputeStatistics (wdStatisticLines)
MsgBox ("The document contains " & NumLines & " Lines")
End sub

But it actually count the line of whole document.

Can anybody help, finding code which could count selected line only?

Martijn Pieters's user avatar

asked Jan 26, 2018 at 7:28

VBAbyMBA's user avatar

Just use Selection.Range object instead of ActiveDocument

Sub Count_Lines()
    MsgBox ("The selection contains " & Selection.Range.ComputeStatistics(wdStatisticLines) & " Lines")
End Sub

answered Jan 26, 2018 at 8:05

SergeyLebedev's user avatar

Your code intends to show the value of NumLines in the message box. However, no value was assigned to that variable. In fact the variable itself was also not declared. The code below fills these two shortcomings and then works just fine. However, it will count all the lines in the document. If you just want the selected lines use the solution offered below.

Option Explicit

Sub Count_Lines()

    Dim NumLines As Long

    NumLines = ActiveDocument.ComputeStatistics(wdStatisticLines)
    MsgBox ("The document contains " & NumLines & " Lines")
End Sub

NB. They say, Option Explicit «forces» you to declare variables which forces the reaction to resist. Compare the force with that of the traffic police who insist on your driving on the right side of the road. Using Option Explicit will not prolong your life but it will drastically reduce the amount of time you spend chasing stupid errors because you are too proud to let your computer point them out to you. Option Explicit was the tool that provided me with an immediate pointer to the source of the problem you are seeking help on here.

answered Jan 27, 2018 at 2:21

Variatus's user avatar

VariatusVariatus

14.3k2 gold badges14 silver badges30 bronze badges

Понравилась статья? Поделить с друзьями:
  • Count letter in word python
  • Count in excel with filter
  • Count in excel with duplicates
  • Count in excel for text
  • Count in excel by name