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


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

Flagging Incorrect Commas in Numbers

If you have a lot of numbers in a document, you may want a way to figure out if those numbers have commas in the wrong ...

Discover More

Getting Input from a Text File

You can use a macro to read information from a text file. The steps are easy, and then you can use that information in ...

Discover More

Creating Worksheets from a List of Names

Need to create a large number of worksheets using specific names? If so, you'll love the ideas presented in this tip.

Discover More

Program Successfully in Excel! This guide will provide you with all the information you need to automate any task in Excel and save time and effort. Learn how to extend Excel's functionality with VBA to create solutions not possible with the standard features. Includes latest information for Excel 2024 and Microsoft 365. Check out Mastering Excel VBA Programming today!

More ExcelTips (ribbon)

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

Removing All Formatting

Getting rid of formatting from a cell or group of cells can be done using several different techniques. This tip ...

Discover More

Automatically Changing a Cell's Background Color

It is often desired to change what is displayed in a cell based on what is in a different cell. What if what you want to ...

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 3 + 9?

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.