Microsoft Office Tutorials and References

In Depth Information

**Syntax**

number_times
—
This is a positive number that specifies the number of

times to repeat text. If number_timesis 0, REPT returns "" (that is,

empty text). If number_timesis not an integer, it is truncated. The res-

ult of the REPT function cannot be longer than 32,767 characters.

In Microsoft Word, it is easy to create a row of periods between text and a

page number. In Excel, you have to resort to clever use of the REPT function

to do this.

In
Figure 11.63
,
column A contains a page number. Column B contains a chapter

title. The goal in column C is to join enough periods between columns B and A

to make all the page numbers line up.

•
number_times

Figure 11.63.

Figure 11.63.
The

The REPT

REPT function can be used to calculate a certain number of

function can be used to calculate a certain number of

repeated entries.

repeated entries.

Note

To make this work, you must change the font in column C to be a fixed-

width font, such as Courier New.

The number of periods to print is the total desired length, less the length

of

columns

A

and

B.

The

formula

for

cell

C2

is

=B2&REPT(".",45-(LEN(A2)+LEN(B2)))&A2.