Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 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

Written by Allen Wyatt (last updated September 19, 2024)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365


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

Defining a Single Conditional Formatting Condition

Conditional formatting is a powerful tool you can use to dynamically adjust the formatting of your worksheet. This tip ...

Discover More

Exact Matches with DSUM

The DSUM function is very handy when you need to calculate a sum based on data that matches criteria you specify. If you ...

Discover More

Creating a Custom Power Management Plan

Don't like the built-in power management plans that Windows provides? You can create your own to better fit your power needs.

Discover More

Professional Development Guidance! Four world-class developers offer start-to-finish guidance for building powerful, robust, and secure applications with Excel. The authors show how to consistently make the right design decisions and make the most of Excel's powerful features. Check out Professional Excel Development today!

More ExcelTips (ribbon)

Professional Looking Fractions

Professional typesetting has, in many ways, spoiled us. One way this is evident is in the preference we show for making ...

Discover More

Changing the Color of a Cell Border

Excel provides a variety of tools you can use to make your data look more presentable on the screen and on a printout. ...

Discover More

Hiding Individual Cells

Hiding information in one or more cells can be a challenge. This tip presents several different techniques that can help ...

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}] (all 7 characters, in the sequence shown) 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 five less than 6?

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.