Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, and Excel in Office 365. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Repeating Cell Contents.

Repeating Cell Contents

by Allen Wyatt
(last updated July 25, 2020)

5

Julius is a former Lotus 1-2-3 user. He notes that in that program, if he presses the "\" key and follows it with anything, Lotus will repeat what he types to fill the entire cell. For example, if he types \12345, Lotus will show 123451234512345..., regardless of the width of the cell. Julius is wondering how to do the same in Excel.

There are a couple of ways you can do this. One is with a formula, using the REPT worksheet function:

=REPT(12345,10)

This formula repeats "12345" ten times. If you want to actually repeat text, then you need to enclose the first parameter within quote marks, such as the following:

=REPT("abcd",10)

This approach works well if you know exactly how many times you want to repeat the text, but not so well if you don't. This leads to the second approach, which is to use formatting for the cell. Follow these steps:

  1. Select the cell or cells you want to format.
  2. Make sure the Home tab of the ribbon is displayed.
  3. Click the small arrow icon at the bottom-right of the Alignment group. Excel displays the Alignment tab of the Format Cells dialog box. (See Figure 1.)
  4. Figure 1. The Alignment tab of the Format Cells dialog box.

  5. Using the Horizontal drop-down list, choose Fill.
  6. Click OK.

The result is that the cell formatting in this way will repeat whatever it contains as many times as it can fit that result into the cell. If the cell is not wide enough to display even one occurrence of the result, then you will see the familiar #### markers. The cell will only display entire occurrences of the result, not partial occurrences. Thus, it will display "1234512345," but not "1234512345123." This means that you may end up with empty space at the right side of a cell if Excel cannot fit into the cell another full instance of what you are repeating.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (6171) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and Excel in Office 365. You can find a version of this tip for the older menu interface of Excel here: Repeating Cell Contents.

Author Bio

Allen Wyatt

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. ...

MORE FROM ALLEN

Making Live URLs Into Normal Text

Convert those URLs into regular text! It's easy to do when you follow the steps in this tip.

Discover More

Precision and Number Display

Do you need to work with very precise numbers in your worksheets? If you do, then it is imperative you understand ...

Discover More

Inserting the Author Name

Did you know that Word tries to keep track of who the author of a document is? This information can be easily added to ...

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!

More ExcelTips (ribbon)

Locking the Background Color

You can spend a lot of time getting the formatting in your worksheets just right. If you want to protect an element of ...

Discover More

Ensuring Conditional Formatting and Data Validation is Copied

If you use an Excel worksheet for entering data (a quite common task, actually), then you need to be concerned with how ...

Discover More

Replacing Background Colors in Cells

Want a quick way to replace background colors in cells? It's easy to do using Find and Replace, or you can simply use the ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is seven more than 0?

2020-07-27 09:53:12

Roy

Not using "Fill" as a formatting option, by the way, just the formula given. A closer reading... DOES show the 'only 12345, not 12345123' parrrt refers only to the Fill formatting, not to the REPT() function. I imagine that's why I get "different" results...


2020-07-27 09:48:52

Roy

Looks like there is a way to attach images so... this is what I get. (see Figure 1 below)

Version is: "Version 2006 (Build 13001.20384 Click-to-Run)"

Figure 1. 


2020-07-26 03:57:49

Mike

Roy

Really strange. I am getting the exact opposite. I can't duplicate your "12345123" example - my results are always truncated, wrap text seems to do nothing, and my result does change dynamically as I change the column width.
I can't test the Shrink-to-Fit as it's greyed out when I select Fill from the horizontal alignment.
If this is due to different versions (I'm using Excel 2010), it seems like this feature is too unpredictable to use when sharing a workbook.


2020-07-25 18:25:58

Roy

Ehh... not that dynamic a re-sizing. One and done is more like it.


2020-07-25 18:09:42

Roy

Well, not so much on a couple points.

First, it WILL give "12345123" rather than "1234512345", "12345", or bust. Doesn't have the least issue doing so.

Second, "Shrink to fit" (STF) works interestingly and obviously.

If nothing to the right interferes, it will pour over the border. (STF stops that.)

"Wrap text" does exactly that. (Overcomes STF as well.)

I've never seen a point to this function anyway, as it seems it would only be of value for a border, or, as occurs to me today, an interesting way of changing the row height, perhaps used to dynamically do so for changes in content of another cell in the row, though that seems redundant as that cell could be made to dominate its own fate. Anyhow, never used it, ever. So I won't say the above facts obtained in every copy of Excel along the way, just right now.

But the Tip says it was last edited RIGHT NOW. So... concerns arise.


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.