How to Create List from Range in Excel


Excel is a robust spreadsheet tool commonly used for data analysis, organization, and computation applications. One of its key characteristics is the ability to construct lists automatically based on a specified range of values. Whether you're working on a small project or managing massive data sets, Excel's list creation functionality can save you substantial time and effort. By exploiting this capability, you may instantly populate fields with a succession of numbers, dates, or custom values, speeding your data entry process.

To follow along, make sure you have Microsoft Excel installed on your computer. While the procedures discussed in this lesson mostly pertain to Excel 2016 and subsequent editions, they are also applicable to prior versions of the software. So, let's dig in and learn how to efficiently build lists from ranges in Excel!

Creating List from Range in Excel

Here we will first create a VBA module and then select the range of cells to complete the task. So let us see a simple process to learn how you can create a list from a range in Excel.

Step 1

Consider an Excel sheet where the data in the sheet is similar to the below image.

First, use Alt + F11 to open the VBA application.

Step 2

Then click on Insert and select Module, then copy the below code into the text box.

Insert > Module > Copy.

Example

Sub UniqueList()
Dim InputRng As Range, OutRng As Range
xTitleId = "Create List Range"
Set InputRng = Application.Selection
Set InputRng = Application.InputBox("Range:", xTitleId, InputRng.Address, Type:=8)
Set OutRng = Application.InputBox("OutPut to (single cell):", xTitleId, Type:=8)
For i = 1 To InputRng.Rows.Count
   For j = 1 To InputRng.Columns.Count
      OutRng.Value = InputRng.Cells(i, j).Value
      Set OutRng = OutRng.Offset(1, 0)
   Next
Next
End Sub

Step 3

Then click F5 to run the module, select the range of tables, and click Ok.

F5 > Select Table > Ok.

Step 4

Then click on single cells to place the data and click OK.

Single Cell > Ok.

Conclusion

In this tutorial, we have used a simple example to demonstrate how you can create a list from a range in Excel to highlight a particular set of data.

Updated on: 12-Jul-2023

578 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements