Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Excel Drop Down List Allow Multiple: Step-by-Step Guide

· 6 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Excel does not natively support selecting multiple items from a standard data validation drop-down list; by default, selecting a new item replaces the previous one. To achieve a multi-select drop-down, you must use a small piece of VBA (Visual Basic for Applications) code that tells Excel to append new selections to the existing cell content rather than overwriting it. This allows you to build a comma-separated list of values within a single cell, which is essential for tracking multiple tags, assigning several team members to a task, or selecting various categories for a single entry.

What You'll Need

  • Microsoft Excel for Windows or Mac (Note: VBA is not supported in Excel for the Web/Online version).
  • A list of items to serve as your drop-down options.
  • Basic access to the Developer tab or the Visual Basic Editor (Alt + F11).
  • A workbook saved in the .xlsm (Excel Macro-Enabled Workbook) format.

Step-by-Step

  1. Create Your Source List: Start by typing the items you want in your drop-down list into a column on a separate worksheet (e.g., Sheet2). For example, if you are tracking project skills, list "Python", "SQL", "Project Management", and "Data Analysis" in cells A1 through A4.
  2. Set Up Data Validation: Go back to your main data entry sheet. Select the cell or range of cells where you want the multi-select drop-down to appear. Navigate to the Data tab on the ribbon, click Data Validation, and in the Allow box, select List. In the Source box, highlight the list of items you created in Step 1. Click OK. At this stage, you have a standard single-select drop-down.
  3. Open the Visual Basic Editor: Right-click on the sheet tab name at the bottom of your screen (e.g., "Sheet1") where the drop-down is located. Select View Code from the context menu. This will open the VBA editor window specifically for that worksheet.
  4. Insert the Multi-Select Code: Copy and paste the following code into the white code window. This script triggers every time a cell is changed; it checks if the cell has data validation and, if so, appends the new selection to the old one using a comma.

    Private Sub Worksheet_Change(ByVal Target As Range) Dim Oldvalue As String Dim Newvalue As String On Error Resume Next If Target.Column = 1 Then If Target.SpecialCells(xlCellTypeAllValidation) Is Nothing Then GoTo Exits If Target.Value = "" Then GoTo Exits Application.EnableEvents = False Newvalue = Target.Value Application.Undo Oldvalue = Target.Value If Oldvalue = "" Then Target.Value = Newvalue Else If InStr(1, Oldvalue, Newvalue) = 0 Then Target.Value = Oldvalue & ", " & Newvalue Else Target.Value = Oldvalue End If End If Application.EnableEvents = True End If Exits: Application.EnableEvents = True End Sub

    Note: In the line If Target.Column = 1 Then, the number 1 refers to Column A. If your drop-down is in Column B, change this to 2; for Column C, change it to 3, and so on.
  5. Adjust the Delimiter: If you prefer a semicolon or a line break instead of a comma, locate the part of the code that says & ", " & and replace the comma with your preferred character. For a line break, use vbCrLf.
  6. Save as Macro-Enabled Workbook: This is the most critical step. Close the VBA window and return to Excel. Go to File > Save As. In the file type drop-down menu, you must select Excel Macro-Enabled Workbook (.xlsm). If you save it as a standard .xlsx file, the code will be deleted and the multi-select functionality will stop working.
  7. Enable Macros: When you reopen the file, Excel may show a security warning at the top stating that macros have been disabled. Click Enable Content to allow the script to run.

Common Mistakes

One of the most frequent errors is forgetting to change the column index in the VBA code. If the code says Target.Column = 1 but your drop-down list is in Column E, the script will never trigger because it is only watching Column A. Always ensure the number matches the column position (A=1, B=2, etc.).

Another common mistake is saving the file as a standard .xlsx workbook. Standard workbooks cannot store VBA scripts. If you do this, the file will save without errors, but the next time you open the document, the multi-select feature will be gone, and you will have to re-paste the code into the editor.

Users also frequently overlook the "Enable Content" banner. Because macros can potentially be used for malicious purposes, Excel disables them by default. If you don't click the yellow warning bar at the top of the screen, the VBA code remains dormant, and the cell will behave like a normal single-select drop-down.

Tips

To prevent duplicate entries in the same cell, the provided code includes an InStr check. This ensures that if a user selects "Python" twice, the code recognizes it is already present and does not add it again. This keeps your data clean and prevents long, repetitive strings of text.

If you want to clear the cell to start over, simply select the cell and press the Delete key on your keyboard. The code is designed to handle empty cells without triggering an error, allowing you to reset the selection easily.

For better visual organization, use Wrap Text on the cells containing your multi-select lists. Since multiple items can make the cell content quite long, wrapping the text ensures that all selected items are visible without needing to widen the column to an extreme degree.

Troubleshooting

The drop-down still only allows one selection: First, check if you are using Excel for the Web. VBA does not work in the browser; you must open the file in the desktop application. Second, check the Target.Column number in your code to ensure it matches the column where your drop-down is located. Third, ensure you clicked "Enable Content" on the security warning bar.

Excel has stopped responding or is lagging: This can happen if Application.EnableEvents = False was triggered but the script crashed before it could be set back to True. To fix this, press Alt + F11 to open the VBA editor, press Ctrl + G to open the Immediate Window, type Application.EnableEvents = True and press Enter. This resets the event listener.

The code is causing an error message: Ensure that you have not accidentally deleted any quotes or parentheses when editing the delimiter. A missing quote mark in the & ", " & section will cause a syntax error that prevents the script from running.

Frequently Asked Questions

Can I use this in Google Sheets?

No, this specific method uses VBA, which is exclusive to Microsoft Excel. Google Sheets uses Apps Script (based on JavaScript) and requires a completely different coding approach to achieve multi-select functionality.

Will this work on Excel for Mac?

Yes, VBA is supported on Excel for Mac, although the interface for the Visual Basic Editor may look slightly different. The code itself remains the same.

How do I remove an item from a multi-select cell?

Currently, the VBA method only allows adding items. To remove a specific item, you must click into the cell (or use the formula bar) and manually delete the unwanted text and the accompanying comma.

Can I apply this to multiple columns at once?

Yes. Instead of If Target.Column = 1 Then, you can use a range check, such as If Not Intersect(Target, Range("A:C")) Is Nothing Then. This would enable the multi-select feature for columns A, B, and C.

Does this affect the file size?

Adding a small VBA script has a negligible impact on file size. However, saving as an .xlsm file changes the internal structure of the workbook, which is required to store the macro.