How do you repeat data in a column in Excel?

This is not difficult or very time-consuming on short lists, but suppose you have hundreds of items and the number of entries in the lists is constantly changing.

Having to manually update each item in the list can be quite irritating.

Let’s see a fast, dynamic way to achieve the initial lists along with perpetual, free and easy updates.

How do you repeat data in a column in Excel?

We begin with a list of names and months.

How do you repeat data in a column in Excel?

The objective is to have each name in the first list repeated for as many months as exists in the second list.

How do you repeat data in a column in Excel?

THE BAD WAY would be to Copy/Paste all the months repeatedly for as many entries in the names list.

Next, Copy/Paste each name for each unique entry in the month’s list.

What makes this inefficient is:

  • Everything is a manual process.
  • The repetition does not scale upwards in an efficient way.
  • If additional months are added, the previous lists must be updated.

Any way you think about it, it’s a losing proposition.

THE GOOD WAY is to produce the lists with just a few clicks using Excel Tables and Power Query.

How do you repeat data in a column in Excel?

Excel Essentials for the Real World - Complete Course

Learn Excel from Scratch or Fill in the Gaps.

Become Confident.

Packed with Challenges & Files (Excel 2016, 2019, Office 365).

GET ACCESS

Preparing the Tables

Our first step is to “upgrade” each of the lists into proper Excel Tables.

Click anywhere in the list of names and press CTRL-T.

In the Create Table dialog box, verify that the cell range holding the names is correct and place a check in the “My table has headers” option (if not already checked.)

How do you repeat data in a column in Excel?

On the Table Design ribbon, change the Table Name to “Names”.

How do you repeat data in a column in Excel?

Repeat the above steps to convert the list of months into a proper Excel Table and name the table “Months”.

How do you repeat data in a column in Excel?

How do you repeat data in a column in Excel?

Now it’s time to bring these Excel Tables into Power Query and work our magic.

Bring the “Months” Table into Power Query

To bring the tables into Power Query, we’ll start with the easiest table first, the Months table.

Click anywhere in the table of months and select Data (tab) -> Get and Transform (group) -> From Sheet.

NOTE: Older versions of Excel will have the button labeled “From Table/Range”.

How do you repeat data in a column in Excel?

This brings the “Months” table into Power Query and interprets the data as text.

How do you repeat data in a column in Excel?

We don’t need to perform any additional transformations to the table, so we will return to ‘regular’ Excel.

Click the lower portion of the Close & Load button and select “Close & Load To…”.

How do you repeat data in a column in Excel?

In the Import Data dialog box, set the option for Only Create Connection and click OK.

How do you repeat data in a column in Excel?

Bring the “Names” Table into Power Query

To bring the “Names” table into Power Query, click anywhere in the table of names and select Data (tab) -> Get and Transform (group) -> From Sheet.

How do you repeat data in a column in Excel?

This brings the “Months” table into Power Query and interprets the data as text.

How do you repeat data in a column in Excel?

We will use this query as the final output for the report, so let’s change the name of the query from “Names” to “Report”.

How do you repeat data in a column in Excel?

Combining and Repeating the Tables

Now it’s time to combine the two tables and perform the monthly name repeats for each name.

Begin by selecting Add Column (tab) -> Custom Column.

How do you repeat data in a column in Excel?

In the Custom Column dialog box, set the new column’s name to “Month” and enter the following formula and click OK:

= Months

How do you repeat data in a column in Excel?

This will produce a list of nested tables.

How do you repeat data in a column in Excel?

To extract the contents of each nested table, click the Expand Tables button located in the header of the newly added “Month” column.

How do you repeat data in a column in Excel?

Uncheck the “Use original column name as prefix” and click OK.

How do you repeat data in a column in Excel?

We now see a list of each name repeated for as many months as are in the “Months” table.

How do you repeat data in a column in Excel?

Before we load the results back to Excel, it’s considered a “best practice” to set the proper data type for each column.

We already have the “Names” column set to Text.  Let’s also set the “Months” to a Text data type.

How do you repeat data in a column in Excel?

How do you repeat data in a column in Excel?

Master Excel Functions in Office 365 & Office 2021 - Complete Course

Excel has Changed Forever! DON'T MISS OUT!

GET ACCESS

Loading the Results Into Excel

To load the results into Excel, click the Close and Load button.

Set the destination to a Table and select a cell next to the original data as the output location.  In this case, we’ll select cell E1 so we can see the original data and results at the same time.  This will make testing easier to verify.

How do you repeat data in a column in Excel?

The results are as follows.

How do you repeat data in a column in Excel?

Testing the Flexibility of the Tables

We have two objectives to test to ensure our output table is fully dynamic.

  • Add/Remove/Change names from the “Names” table.
  • Add/Remove months from the “Months” table.

Change one of the names in the “Names” table.

Next, right-click on the output table and select REFRESH.

How do you repeat data in a column in Excel?

Now add months to the “Months” table, then right-click the output table and select REFRESH.

How do you repeat data in a column in Excel?

Think Outside the Proverbial Box

Users of Power Query know it’s the go-to tool when connecting to external sources and transforming data.

What we sometimes forget is that Power Query can be used on local data to create solutions that would require complex formulas and possibly complicated VBA macros.

With just a few simple clicks and a tiny bit of typed text, we’re able to easily solve problems that most users would walk away from.