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.
Written by Allen Wyatt (last updated September 19, 2024)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365
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:
Figure 1. The Alignment tab of the Format Cells dialog box.
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.
Excel Smarts for Beginners! Featuring the friendly and trusted For Dummies style, this popular guide shows beginners how to get up and running with Excel while also helping more experienced users get comfortable with the newest features. Check out Excel 2013 For Dummies today!
Need the contents of a cell to be shown in a direction different than normal? Excel makes it easy to have your content ...
Discover MoreIs the information in your cells too jammed up? Here are some ways you can add some white space around that information ...
Discover MoreHow Excel displays numbers is extremely flexible, but it can also be very confusing. This tip looks at how number display ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
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.
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.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2024 Sharon Parq Associates, Inc.
Comments