How to Populate List Based on Cell Value in Excel (8 Methods)

Populating a list based on cell value in Excel means automatically adding information that meets certain criteria.

In this Excel tutorial, we will learn how to populate a list based on a cell value in Excel.

For example, in the following GIF, we have the employee names of the respective departments. Here, we populated the list of employees based on a department in 2 different ways by using formulas.

Excel Populate List Based on Cell Value

Populating a list based on cell value in Excel can be done by using Excel formulas and the Data Validation feature.

Learning how to populate a list based on cell value can help us to get the subset of a large dataset that meets a particular condition.


1. Populating Data Validation Drop-Down List Based on Cell Value in Excel

In this part, we’ll populate a data validation drop-down list based on cell value using the Data Validation feature and Excel functions.

Let’s see the dataset first. The following image presents the respective employees of 3 different departments. Here, we’ll show how to populate a drop-down list with employee names based on the department we select. Then we can select employee names from the drop-down options to fill the list.

dataset of employees


1.1 Creating Dependent Drop-Down List Using INDIRECT Function

In this section, we’ll create a dependent drop-down list that depends on a cell value using the Data Validation and the INDIRECT function.

We’ll first make a drop-down list for selecting the departments as well. So learn the steps below.

Steps:

  • Select the range B7:D13 => Type Marketing in the Name Box to name the cell range.

naming the departments

  • Similarly, name the respective cell ranges for the Sales and Finance departments.
  • Next, select the range B16:B22 => go to the Data tab.

creating data validation for department inputs

  • Select Data Validation from the Data Tools group >> choose List in the Allow field >> set B6:D6 as the Source.

selecting source for departments

  • Press OK to close the dialog box.

In this way, we create the drop-down list of departments. Click the drop-down icon and you’ll see the available options.

drop-down list of departments

Now, we’ll create a drop-down list of employee names based on the department.

  • Select the range C16:C22 => Go to the Data tab.

creating data validation for employee names

  • In the Data Tools group, select Data Validation >> choose List in the Allow field.
  • Write the below formula in the Source field:
=INDIRECT(B16)

selecting source list for employee names

  • Press OK to close the dialog box.
  • Now, select Sales from the department drop-down.
  • The corresponding drop-down list in C16 will display the employee names of the Sales department only.

drop-down list of employee names

In this way, you can populate the list by selecting from the drop-down options. Here, I’ve filled a portion of the list in the following picture.

populating list by selecting from drop-downs

Now let’s change the department in cell B19 from Finance to Marketing. However, the corresponding employee name in cell C19 still stays there without getting cleared. And this is not desired.

changing a department

We want to clear the corresponding employee name as soon as we change a department. To achieve this outcome, we’ll apply Excel VBA.

  • First, go to the Developer tab => select Visual Basic.

selecting visual basic

  • In the VBA window, double-click on Sheet2 (Dependent Drop-Down List) from the Microsoft Excel Objects.
  • In the popped-out code window, paste the following code:
Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
If Target.Column = 2 Then
 If Target.Validation.Type = 3 Then
 Application.EnableEvents = False
 Target.Offset(0, 1).ClearContents
 End If
End If
exitHandler:
 Application.EnableEvents = True
 Exit Sub
End Sub

pasting code in Excel VBA

  • Save the file and close the VBA window.
  • Now try changing a department. The corresponding employee’s name will be cleared immediately.

changing department automatically clears employee name

Read More: How to Create Dynamic Dependent Drop Down List in Excel


1.2 Restricting Changes in the First Drop-Down List Using IF and INDIRECT Functions

In this section, we’ll use the IF and INDIRECT functions in the Data Validation to restrict the changes in the first drop-down list of the previous method. The first drop-down list was of department names. So, after restricting, we cannot change the department anymore.

The steps are exactly the same as the previous method to open the Data Validation after selecting the cell range for departments. After choosing List in the Allow field, insert the below formula in the Source field:

=IF(B16="",Department, INDIRECT("FakeRange"))

modifying source for restricting changes in the department

  • Press OK to close the dialog box.
  • A warning message box will pop out. Click Yes.

pressing yes

  • Now click the drop-down of the already inserted department. It’ll have no effect.

clicking drop-down icon will not open list

Read More: How to Use IF Statement to Create Drop-Down List in Excel


2. Combining INDEX, ROW, and MATCH Functions to Automatically Populate List Based on Cell Value

In this section, we’ll combine the INDEX, ROW, and MATCH functions to automatically populate the list based on cell value in Excel. However, we’ll make a drop-down list for selecting the cell value first by using the Data Validation feature. In this way, we don’t have to type the value manually.

Follow the steps below to perform the task.

Steps:

  • Select cell C15 => Go to the Data tab.

selecting data validation

  • Select Data Validation from the Data Tools group.

The Data Validation dialog box appears.

  • In the Allow field, choose List from the drop-down.
  • Select B6:D6 as the Source.

source selection in data validation dialog

  • Press OK.

Hence, the department drop-down list appears in cell C15. You can choose any of them.

department list drop-down

  • Now, select cell C18 and write the formula:
=INDEX($B$6:$D$13,ROW(B2:D8),MATCH($C$15,$B$6:$D$6,0)) & ""
  • Press Enter.

It’ll spill the employees’ list of the department mentioned in cell C15.

combining functions and & operator to auto populate list based on cell value in excel

  • Let’s change the department to Finance. The list will get updated automatically.

populating list dynamically based on different cell value

Formula Breakdown

=INDEX($B$6:$D$13,ROW(B2:D8),MATCH($C$15,$B$6:$D$6,0)) & “”

=INDEX($B$6:$D$13,ROW(B2:D8),3) & “” // MATCH($C$15,$B$6:$D$6,0) returns 3 because C15 (Finance) is matched in position 3 in the range B6:D6.

=INDEX($B$6:$D$13,{2;3;4;5;6;7;8},3) & “” // ROW(B2:D8) returns {2;3;4;5;6;7;8} because the ROW function returns the row number of the cell references.

=Pablo Beck & “” // INDEX($B$6:$D$13,{2;3;4;5;6;7;8},3) returns Pablo Beck because the intersection of row 2 and column 3 in the range B6:D12 is Pablo Beck.

=Pablo Beck // Because concatenating with “” using the & operator still returns Pablo Beck.

As our formula is a dynamic array formula, it spills all the values present in the intersection of each of the rows 2 to 8 and column 3.

If no value is found, it returns 0, but concatenating 0 with “” using the & operator results in an empty string, thus we see blank cells.

NOTE: The & operator will convert the cell to a text value. So problems might arise if you have further calculations involving that cell.

We can also use the below formula with the IF function to return blank cells instead of 0 when auto-populating a list based on cell value.

=IF(INDEX($B$6:$D$13,ROW(B2:D8),MATCH($C$15,$B$6:$D$6,0))<>0, INDEX($B$6:$D$13,ROW(B2:D8),MATCH($C$15,$B$6:$D$6,0)), "")

using excel IF to auto populate list based on cell value

Moreover, we can apply Conditional Formatting to make the 0 values invisible by making the font color white wherever we find them. Here, the formula we used is:

=IFERROR(INDEX($B$6:$D$13,ROW(B2:D8),MATCH($C$15,$B$6:$D$6,0)), "")

It’s pretty much the same formula as we used earlier, the additional IFERROR function here will return blanks if any error is encountered.

combining multiple functions to populate list

To apply Conditional Formatting, follow the steps:

  • Select the desired range => Select Conditional Formatting drop-down.

selecting conditional formatting

  • Click New Rule.

The New Formatting Rule dialog appears.

  • Choose Format only cells that contain rule type.
  • In the Format only cells with fields, select Cell Value => equal to => 0.

defining rule to format

  • Next click Format.
  • In the Format Cells dialog box, go to Font => choose White as Color.

pressing ok to apply formatting

  • Press OK to close the Format Cells dialog box.

pressing ok to apply formatting

  • Again press OK to close the New Formatting Rule dialog box.

Thus we get the desired output.

conditional format applied to make 0 values in white color

The following GIF displays the dynamic list generation whenever we change the department.

gif for showing the populated list based on cell value

Read More: Excel Formula Based on Drop-Down List


3. Inserting FILTER Function for Populating List Based on Cell Value in Excel

In this part, we’ll use the FILTER function for populating a list based on cell value in Excel. This method shows how to populate a list with employee names based on the department we choose. The department selection is done by using the Data Validation drop-down as shown in the previous methods.

Learn the steps below to perform the task.

Steps:

  • Select cell C17 => Insert the following formula:
=FILTER(B7:D13, C15=B6:D6) & ""
  • Press Enter. The respective employee list will get spilled depending on the department in cell C15.

using FILTER function to populate list based on cell value in excel


4. Combining UNIQUE and FILTER Functions to Populate the List with Non-repeating Entries

In this section, we’ll combine the UNIQUE and FILTER functions to populate the list with non-repeating entries in Excel.

Sometimes, the list may accidentally contain an employee’s name multiple times which is not desired. Follow the steps below to avoid getting repetitive names. Here, the department selection is done by using the Data Validation drop-down as shown in the previous methods.

Steps:

  • Select cell C17=> Write the below formula:
=UNIQUE(FILTER(B7:D13, C15=B6:D6)) & ""
  • Press Enter and the formula will spill the employee list of the respective department.

using FILTER & UNIQUE functions to populate list with non-repeating entries

In the following image, notice that Ramiro Harper was found twice in the Sales department in the main dataset. However, in the spilled result, the name occurs only once.

populated list of sales employees without repetitive names


5. Populating List Based on Cell Value by Using Excel Array Formula

In this method, we’ll use an Excel array formula to populate a list based on cell value.

Let’s get introduced to the dataset first. In the following image, we have some IDs, Brands, Model names, and the Unit Prices of different mobile phones. Here, we’ll select a brand name in cell C16 from the drop-down options. And we want to get all the information about the mobile phones available for that brand only.

Dataset of phones for array formula

Follow the steps below to accomplish the task.

Steps:

  • Select cell B19 => Insert the below formula:
=IFERROR(INDEX($B$7:$E$14,SMALL(IF(COUNTIF($C$16:$C$17,$C$7:$C$14), MATCH(ROW($B$7:$E$14), ROW($B$7:$E$14)), ""), ROWS(B19:$B$19)), COLUMNS($B$6:B6)),"")
  • Press Enter => Apply AutoFill to the right side and also to the cells below.

Thus you’ll get a list of all the information about the mobile phones for that brand only.
The following GIF shows how to apply the AutoFill accurately.

gif of array formula

You can change the cell formatting for the Unit Prices from General to Accounting through the Number group in the Home tab.

using excel array formula to populate list based on cell value


6. Joining FILTER and INDIRECT Functions to Populate List Based on Cell Value

In this method, we’ll combine FILTER and INDIRECT functions to populate a list based on cell value in Excel.

Let us show you the dataset first. Usually, customers first get a token based on the service they need whenever they go to a bank. Each of the bank employees provides a particular service based on their expertise and experience.

In the following dataset, you’ll see different token numbers are assigned to different employees (denoted by x). We want to get the list of token numbers assigned to a particular employee we select.

dataset of token numbers and service providers for filter indirect method

Follow the steps below to perform the task.

Steps:

  • Select the range B6:E16 => Go to the Insert tab.

creating table

  • In the Tables group, select Table.

The Create Table dialog box will pop out.

pressing ok in create table dialog

  • Press OK.

This will create an Excel table.

Excel table

  • Now, select the range B7:E16 => type Table1 in the Name Box for naming the selected range.

naming the table

  • Select cell H8 => Type the following formula:
=FILTER(Table1[Token No.],INDIRECT("Table1["&H6&"]")="x")
  • Press Enter. It’ll spill the list of token numbers assigned to the employee mentioned in cell H6.

using FILTER & INDIRECT functions to populate list based on cell value

Read More: Create Excel Filter Using Drop-Down List Based on Cell Value


7. Populating List Based on Multiple Cell Values in Excel

In this section, we’ll combine multiple functions to populate a list based on multiple cell values in Excel.

Let’s understand the dataset first. In the following image, we have IDs, Brands, Model names, and Unit Prices of several mobile phones. Here, we’ll populate a list of phones by Model names based on the Brand Name and the Unit Price.

dataset of phones for populating list based on multiple values

Steps:

  • Select cell E17 => Insert the formula:
=IFERROR(INDEX($D$7:$D$14,SMALL(IF(($C$7:$C$14=$B$17)*IF($C$17=">=",($E$7:$E$14>=$D$17), IF($C$17=">",($E$7:$E$14>$D$17), IF($C$17="<=",($E$7:$E$14<=$D$17), IF($C$17="=",($E$7:$E$14=$D$17), ($E$7:$E$14<$D$17))))), ROW($C$7:$C$14)), ROW(1:1))-6,1),"")
  • Press Enter => Apply AutoFill.

combining multiple functions to populate list based on multiple values in excel

NOTE: We used Conditional Formatting to highlight the spilled results.

The following GIF shows how to apply the AutoFill correctly.

gif of populating list based on multiple values

Read More: How to Create Dependent Drop Down List with Multiple Words in Excel


8. Combining IFERROR, VLOOKUP, and COLUMN Functions to Populate the List Based on Cell Value

In this last method, we’ll combine the IFERROR, VLOOKUP, and COLUMN functions to populate the list based on cell value.

Suppose, our case is rather simple where we have the Full Name of the employees, their Department, Designation, and Annual Salary. We want to extract the list of info based on their Full Name. Since we have the names in the first column of the dataset, we can use the VLOOKUP function.

dataset of employee info for vlookup

Follow the steps below to accomplish the task.

Steps:

  • Select cell B19 => Type the formula:
=IFERROR(VLOOKUP($C$16,$B$7:$E$14,COLUMN(B3),FALSE), "")
  • Press Enter => Drag the AutoFill to the right.

Hence you’ll get the list of information of the respective employee selected in cell C16.

joining multiple functions to populate list based on cell value


Download Practice Workbook


In this article, we have shown how to populate a list based on cell value in Excel. This will help us to get the desired information quickly without manually looking for it in a large dataset. We have explained different scenarios using 8 different methods. The methods require several Excel functions and also the Data Validation feature. Scenarios include: automatically populating the list; populating the list by selecting from the drop-down options, etc. Leave a comment for any further queries.


Further Readings


<< Go Back to Excel Drop-Down List | Data Validation in Excel | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Md. Abdullah Al Murad
Md. Abdullah Al Murad

Md. Abdullah Al Murad is a computer engineer who loves exploring Excel and VBA programming. Programming, to him, is a time-saving tool for efficiently managing data, files, and internet tasks. He is proficient in C, C++, Python, JavaScript, HTML, SQL, MySQL, PostgreSQL, Microsoft Office, and VBA and goes beyond the basics. He holds a B.Sc. in Computer Science and Engineering from American International University-Bangladesh. He has transitioned into the role of a content developer. Beyond his work, find... Read Full Bio

6 Comments
  1. Thank you much for very useful tools Md. Abdullah!

    I do have a question…

    On solution #1 the list fill cell formula is :
    =IFERROR(INDEX($B$4:$D$12,ROW(B3:D12),MATCH($C$14,$B$4:$D$4,0)),””)

    There is no data on Row 3… why does formula use ROW(B3:D12)? Yet INDEX & MATCH use B4?
    Just trying to understand how formula works better. Thanks!

    • Reply Avatar photo
      Musiha Mahfuza Mukta Feb 19, 2023 at 11:13 AM

      Thank you ROB for your comment. Here, ROW function is working as the row index number of the INDEX function. Actually, it should be ROW(B2:D9)=> {2;3;4;5;6;7;8;9} which denotes respectively the 2nd, 3rd, 4th…. up to 9th row number of this ($B$4:$D$12) array of INDEX function. Here, we ignore the 1st row of ($B$4:$D$12) this array as 1st row contains the Club Name’s not any player Name’s.
      On the other hand, you have to use B4:D4 row in the MATCH function which will search for the Club Name’s and act as the column index number in the INDEX function.
      Say, when you choose Borussia Dortmund or C4 cell from the list of C14 cell then the MATCH function will return 2 and thus the column index number of INDEX function will be 2 so INDEX function will give all the rows (except 1st one) of 2nd column of the given array which means all the player name’s of the Borussia Dortmund club.
      So, you can use the formula like the below one. =IFERROR(INDEX($B$4:$D$12,ROW(B2:D9),MATCH($C$14,$B$4:$D$4,0)),””)
      Use of INDEX, MATCH, ROW functions

  2. Can someone please help me understand what I need to do? I have column A,B,C. A and B have a persons first name and surname, C is a Yes or no answer indicated by Y or N.
    I want a formula that will copy their name into another sheet but only if the answer in C is Y.

    • Thanks for reaching out.

      You can follow method 3 of this article to accomplish your task. Go to the destination sheet and click a cell where you want to paste the names. Insert this formula:
      =FILTER(Source!A2:B20, “Y”=Source!C2:C20)
      Press Enter to get the results. Here, “Source” is the sheet name of your source sheet where the names are present along with Yes/No. A2:B20 is the cell range of the first and last names. Change it according to your dataset. C2:C20 is the cell range with Yes/No.

      This should work. Hope this helped.
      Regards,
      Aung
      ExcelDemy.

  3. Hi

    so, I have tried to follow each of the steps outlined and they are so clear and concise I hate to ask my question, but I keep getting stuck – so apologies first and foremost.

    I have 4 columns of data let’s say – Subs / Employee / Title / Rate

    Depending on which Sub is selected then the associated list of employees for that Sub should be selectable in the employee column and likewise their Title and rate should reflect in the next columns – no matter what I do I cannot get them to align

    Any ideas would be MUCH appreciated

    • Reply Lutfor Rahman Shimanto
      Lutfor Rahman Shimanto Nov 30, 2023 at 11:25 AM

      Hello BEN

      Thanks for reaching out and sharing your problem. The requirements you mentioned can be achieved by following some steps.

      Follow these steps:

      Step 1: Create a Drop-down for Subs

      Step 2: Find Employees Based on Subs in an Intermediate Column
      Select cell F2 => Insert the following formula => Hit Enter.

      =FILTER(B2:B16,A2:A16=A23)

      Step 3: Create a Drop-down for Employees

      Step 4: Display Title and Rate Based on Employee
      Select cell C23 => Insert the following formula => Hit Enter.

      =IF(B23<>“”,FILTER(C2:D16,B2:B16=B23),””)

      Step 5: Hide the Intermediate Column and Insert an Event Procedure
      Hide column F => Right-click on the sheet name tab => Click on View Code => Paste the following code in the sheet module => Save.

      
      Private Sub Worksheet_Change(ByVal Target As Range)
      
          If Target.Address = "$A$23" Then
              Range("B23").ClearContents
          End If
      
      End Sub
      

      OUTPUT: Return to the sheet and make desired changes to see the result like the following GIF.

      You can download the solution workbook for better understanding.
      Download Solution Workbook

      Hopefully, the idea will help you in reaching your goal. Good luck!

      Regards
      Lutfor Rahman Shimanto

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo