Can you allow multiple selections in Excel drop-down list?

By default, you can only select one item per time from a data validation drop-down list in Excel. How to make multiple selections from the drop-down list as below screenshot shown? The methods in this article can help you solve the problem.

Create drop down list with multiple selections with VBA code
Easily create drop down list with multiple selections with an amazing tool

More tutorial for drop down list...

Create drop down list with multiple selections with VBA code

You can apply the below VBA code to make multiple selections from the drop-down list in a worksheet in Excel. Please do as follows.

1. Open the worksheet you have set data validation drop-down list, right click on the sheet tab and select View Code from the context menu.

2. In the Microsoft Visual Basic for Applications window, copy the below VBA code into the code window. See screenshot:

VBA code: drop down list with multiple selections

Private Sub Worksheet_Change[ByVal Target As Range] 'Updated by Extendoffice 2019/11/13 Dim xRng As Range Dim xValue1 As String Dim xValue2 As String If Target.Count > 1 Then Exit Sub On Error Resume Next Set xRng = Cells.SpecialCells[xlCellTypeAllValidation] If xRng Is Nothing Then Exit Sub Application.EnableEvents = False If Not Application.Intersect[Target, xRng] Is Nothing Then xValue2 = Target.Value Application.Undo xValue1 = Target.Value Target.Value = xValue2 If xValue1 "" Then If xValue2 "" Then If xValue1 = xValue2 Or _ InStr[1, xValue1, ", " & xValue2] Or _ InStr[1, xValue1, xValue2 & ","] Then Target.Value = xValue1 Else Target.Value = xValue1 & ", " & xValue2 End If End If End If End If Application.EnableEvents = True End Sub

3. Press the Alt + Q keys to close the Microsoft Visual Basic for Applications window.

Now you can select multiple items from the drop-down list in current worksheet.

Notes:

  • 1. Duplicate values do not allow in the drop-down list.
  • 2. When closing the workbook, the VBA code will be removed automatically, and the multiple selection is unusable anymore. Please save the workbook as an Excel Macro-Enabled Workbook in order to keep the code working in the future.

Easily create drop down list with multiple selections with an amazing tool

Here highly recommended the Multi-select Drop-down List feature of Kutools for Excel for you. With this feature, you can easily select multiple items from the drop-down list in a specified range, current worksheet, current workbook or all opened workbooks as you need.

Before applying Kutools for Excel, please download and install it firstly.

1. Click Kutools > Drop-down List > Multi-select Drop-down List > Settings. See screenshot:

2. In the Multi-select Drop-down List Settings dialog box, please configure as follows.

  • 2.1] Specify the applying scope in the Apply to section. In this case, I select Current worksheet from the Specified Scope drop-down list;
  • 2.2] In the Text Direction section, select an text direction based on your needs;
  • 2.3] In the Separator box, enter a delimiter which you will use to separate the multiple values;
  • 2.4] Check the Do not add duplicates box in the Options section if you don’t want to make duplicates in drop-down list cells;
  • 2.5] Click the OK button. See screenshot:

3. Please click Kutools > Drop-down List > Multi-select Drop-down List to enable the feature.

Now you can select multiple items from the drop-down list in current worksheet or any scope you have specified in step 2.

  If you want to have a free trial [ 30-day] of this utility, please click to download it, and then go to apply the operation according above steps.

Related articles:

Autocomplete when typing in Excel drop down list
If you have a data validation drop down list with large values, you need to scroll down in the list just for finding the proper one, or type the whole word into the list box directly. If there is method for allowing to auto complete when typing the first letter in the drop down list, everything will become easier. This tutorial provides the method to solve the problem.

Create drop down list from another workbook in Excel
It is quite easy to create a data validation drop down list among worksheets within a workbook. But if the list data you need for the data validation locates in another workbook, what would you do? In this tutorial, you will learn how to create a drop fown list from another workbook in Excel in details.

Create a searchable drop down list in Excel
For a drop down list with numerous values, finding a proper one is not an easy work. Previously we have introduced a method of auto completing drop down list when enter the first letter into the drop down box. Besides the autocomplete function, you can also make the drop down list searchable for enhancing the working efficiency in finding proper values in the drop down list. For making drop down list searchable, try the method in this tutorial.

Auto populate other cells when selecting values in Excel drop down list
Let’s say you have created a drop down list based on the values in cell range B8:B14. When you selecting any value in the drop down list, you want the corresponding values in cell range C8:C14 be automatically populated in a selected cell. For solving the problem, the methods in this tutorial will do you a favor.

More tutorial for drop down list...

Excel doesn’t have any built-in feature that allows you select multiple items in a dropdown. In this guide, we're going to show you how to make multiple selections in a dropdown list in Excel.

Download Workbook

Preparation

  1. Start by creating a standard data validation dropdown. The rest will be handled with a VBA macro.
  2. Once the dropdown is ready, press the Alt + F11 keys to open VBA
  3. Double-click on the sheet item on the Project pane to the left. This will open the corresponding editor on the right.

The code should be in the worksheet’s editor containing the dropdown, because the code tracks changes in the cell.

VBA Code to make multiple selections in a dropdown list

All you need to do is to copy and paste the following code into your file and change the cell reference of the dropdown.

Private Sub Worksheet_Change[ByVal Target As Range]

'Define variables

Dim ExistingValue As String

Dim NewValue As String

Dim Separator As String

'If an error occurs, enable events and quit the code

On Error GoTo Quit

'Check if the dropdown cell is changed

If Target.Address = "$F$2" Then

'If user deletes the dropdown cell's data do nothing

If Target.Value = "" Then GoTo Quit

'The fun begins

Application.EnableEvents = False

NewValue = Target.Value

Application.Undo

ExistingValue = Target.Value

If ExistingValue = "" Then

Target.Value = NewValue

Else

'Check if the dropdown item is already selected

If InStr[1, ExistingValue, NewValue] = 0 Then

Target.Value = ExistingValue & ", " & NewValue

Else

Target.Value = ExistingValue

End If

End If

End If

Quit:

Application.EnableEvents = True

End Sub

The dropdown cell’s address is on the 9th row of the code. If you are using a named range, replace the cell address “$F$4” with Range[].Address. To learn more about the cell referencing in VBA, check out How to refer a range or a cell in Excel VBA.

Check the 22nd line if you want to use another character as a separator and replace the comma with any character you want.

Parsing multiple selected values

You can even parse the selected values to consolidate the corresponding data. Check out following example.

You can find detail information about text parsing in our How to split text with formulas in Excel article.

Video liên quan

Chủ Đề