Source: https://oguzerol.com/en/excel-multi-select-dropdown/
[ View full size](https://oguzerol.com/gorseller/hizmet-kapaklari/excel-sheets-20261031-excel-coklu-secim-en.webp)
# Excel Multi-Select Dropdown: VBA, Checkboxes and Correct Counting
[Oğuz Erol](https://oguzerol.com/en/about-me/) | 13 min read | Published: 9 October 2026 | Updated: 31 October 2026
## Key takeaways
- Excel's data validation list writes one value per cell; accumulating several needs a VBA macro, which Microsoft says does not run on the web or iOS.
- In the fictional example a wildcard COUNTIF found SUP-1 on 72 materials instead of 41 because it also caught SUP-10, SUP-11 and SUP-12; a SEARCH bounded by the separator returned 41.
- In a link table a suspension is one cell; with SUP-1 and SUP-2 both suspended, one formula lists the 15 materials left without an active supplier, while comma-separated cells need four spellings searched.
Excel’s built-in dropdown (Data > Data Validation > List) writes one value into a cell; a second pick replaces the first. To accumulate text such as “SUP-2, SUP-1” in one cell, add a small VBA macro to the sheet; it does not run in Excel for the web or on iPhone and iPad. The macro-free route is a checkbox column per option or a row per selection. Count macro-built comma-separated cells with a SEARCH bounded by the separator, not a wildcard COUNTIF: in the example below the wildcard returns 72 instead of 41.
*Source note: [Microsoft’s drop-down list page](https://support.microsoft.com/en-us/office/create-a-drop-down-list-7693307a-59ef-400a-b769-c5402dce407b) does not define a multi-select option; I read every Microsoft source on this page on 2026-10-31. I did not run the formulas or the macro in Excel; what needs testing is listed near the end.*
## Example: 180 material records, 12 approved suppliers
*The plant, codes and numbers are fictional. Every number comes from a Python script that counts the data; it does not imitate Excel’s error or spill behaviour.*
A hydraulic cylinder manufacturer’s purchasing team keeps 180 material records on a “Materials” sheet: code in column A (MAT-001 to MAT-180), “Approved suppliers” in column B, made multi-select by the macro with 12 options, SUP-1 to SUP-12. 52 materials have one approved supplier, 86 have two and 42 have three: 350 selections. The first rows read “SUP-6, SUP-2, SUP-9”, “SUP-2, SUP-1”.
Quality suspends SUP-1. Purchasing asks: on which materials is SUP-1 approved, and which have no other approved supplier? The answer is 41 materials, 11 without an alternative. Those 11 urgently need a second approved supplier; the other 30 can switch.
## 1. Multi-select in one cell with VBA
The macro appends the picked item to the cell’s text; picking an item already there removes it. I walked through the logic step by step; try it on a copy first.
### Setup
1. On a “Suppliers” sheet, put “Code” and “Status” in A1:B1, the 12 codes below with “Active” beside each. Select A1:B13, press Ctrl+T, name the table `tblSupplier`.
2. Via **Formulas > Define Name**, define `SupplierList` as `=tblSupplier[Code]`. Microsoft’s dropdown page recommends a table source, so new codes reach the list automatically.
3. Select Materials!B2:B181, choose **Data > Data Validation > List** and enter `=SupplierList` as the source.
4. Save the file as an **Excel Macro-Enabled Workbook (.xlsm)**.
5. Press Alt + F11, double-click the Materials sheet and paste the code into its sheet module, not a standard module.
### The code
```
Option Explicit
Private Const SEP As String = ", "
Private mOld As String ' the cell's value before the pick
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If IsError(ActiveCell.Value) Then mOld = "" Else mOld = CStr(ActiveCell.Value)
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
Dim picked As String, result As String, parts() As String
Dim i As Long, found As Boolean
If Target.CountLarge > 1 Then Exit Sub
If Intersect(Target, Me.Range("B2:B500")) Is Nothing Then Exit Sub
If IsError(Target.Value) Then Exit Sub
picked = CStr(Target.Value)
If Len(picked) = 0 Then mOld = "": Exit Sub
' Leave typed or pasted text that is not in the list untouched
If IsError(Application.Match(picked, ThisWorkbook.Names("SupplierList").RefersToRange, 0)) Then Exit Sub
On Error GoTo Done
Application.EnableEvents = False
If Len(mOld) > 0 Then
parts = Split(mOld, SEP)
For i = LBound(parts) To UBound(parts)
If StrComp(parts(i), picked, vbTextCompare) = 0 Then
found = True ' already selected: remove it
Else
result = result & IIf(Len(result) > 0, SEP, "") & parts(i)
End If
Next i
End If
If Not found Then result = result & IIf(Len(result) > 0, SEP, "") & picked
If Len(result) = 0 Then Target.ClearContents Else Target.Value = result
mOld = result
Done:
Application.EnableEvents = True
End Sub
```
Change the range (`B2:B500`) and the name (`SupplierList`) to match your file. `Application.EnableEvents = False` stops the macro’s own write from firing `Worksheet_Change` again; `Done` switches events back on even after an error. `SelectionChange` stores the previous text.
### Testing
1. Pick SUP-2 in B2: the cell should read `SUP-2`.
2. Pick SUP-1 in the same cell: `SUP-2, SUP-1`.
3. Pick SUP-2 again: `SUP-1`.
4. Pick SUP-1 again: the cell should be empty. This relies on Excel firing the change event when the same value is picked; not tested.
5. Clear the cell with Delete and pick again: it should start fresh.
If a step fails, check that macros are enabled and the code is in the sheet module; if it stops reacting after an error, run `Application.EnableEvents = True` in the Immediate window.
### Limits
- **Undo.** According to [Microsoft’s OnUndo documentation](https://learn.microsoft.com/office/vba/api/excel.application.onundo), if a procedure does not use the OnUndo method, the Undo command is disabled. This code does not use it, so Ctrl+Z will not reverse a pick.
- **Web, Mac, phone.** Microsoft’s [Office Scripts and VBA comparison](https://learn.microsoft.com/office/dev/scripts/resources/vba-differences) shows VBA running on Windows and Mac, not on the web or iOS; [on the web](https://support.microsoft.com/en-us/office/work-with-vba-macros-in-excel-for-the-web-98784ad0-898c-43aa-a1da-4f0fb5014343) macros stay in the file but do not run. There the list stays single-select.
- **Macro security.** Microsoft states that [in Office on Windows, macros in files from the internet or email attachments are blocked by default](https://learn.microsoft.com/microsoft-365-apps/security/internet-macros-blocked); the user must unblock the file in its Properties dialog. The page says Mac, Android, iOS and the web are not affected.
- **Separator.** Option names must not contain ”, ”. For one item per line, set `SEP` to `vbLf`, turn on Wrap Text and use `CHAR(10)` instead of ”, ” in section 3.
- **Validation.** The combined text is not in the list, so a later hand edit is rejected; pasted values are not checked at all.
## 2. Macro-free alternatives: checkboxes and form controls
Without a macro each option gets its own column. Two of three routes need no VBA; the multi-select list box does.
**In-cell checkboxes (Microsoft 365).** On a “Boxes” sheet, put material codes in column A and supplier codes in B1:M1, select B2:M181 and choose **Insert > Checkbox**. [According to Microsoft](https://support.microsoft.com/en-us/office/using-checkboxes-in-excel-da85546d-c110-49b8-b633-9cebadcaf8d4), a checked box holds TRUE and an unchecked box FALSE; the page lists Excel for Microsoft 365 on Windows and Mac. That is 2,160 boxes; `=COUNTIF(B2:B181,TRUE)` gives 41 for SUP-1, no wildcard trap. For comma-separated text, put `=TEXTJOIN(", ",TRUE,FILTER($B$1:$M$1,B2:M2,""))` in N2; the final `""` returns blank, not an error, when no box is ticked. Limit: each new supplier needs a column, and an approval date has nowhere to go.
**Form control checkboxes.** The older boxes from the Developer tab work without macros, each through its own cell link. [Microsoft’s page](https://support.microsoft.com/en-us/office/form-controls-9f201e46-8f6b-4a9d-a320-f44b28088cb0) lists versions from Excel 2016 to Microsoft 365 and says check box controls cannot be used in Excel for the web. They suit a small entry screen, not 180 rows.
**Multi-select list box.** [Microsoft’s documentation](https://learn.microsoft.com/office/vba/api/excel.controlformat.multiselect) says multi-select list boxes cannot be linked to a cell with LinkedCell, so VBA is needed.
## 3. How do you count and list a multi-value cell correctly?
To count a code correctly in a comma-separated cell, search for it with its separators: `", SUP-1,"` inside the cell text with ”, ” added in front and ”,” at the end. A wildcard COUNTIF does not do this. For the Google Sheets version, see the [Google Sheets multiple selection guide](https://oguzerol.com/en/google-sheets-multiple-selection-dropdown/).
### Trap 1: searching SUP-1 with wildcards also counts SUP-10, SUP-11 and SUP-12
`=COUNTIF(B2:B181,"*SUP-1*")` returns 72. [Microsoft’s COUNTIF page](https://support.microsoft.com/en-us/office/countif-function-e0de10c6-f885-4e71-abb4-1f464816df34) says an asterisk matches any sequence of characters and criteria are not case sensitive. “SUP-11” contains “SUP-1”, so MAT-003 (“SUP-5, SUP-2, SUP-11”) is counted, and 31 materials without SUP-1 enter the list. AutoFilter’s Text Filters > Contains “SUP-1” also matches substrings; I would expect the same 72.
Without wildcards, `=COUNTIF(B2:B181,"SUP-1")` returns 11: cells holding only SUP-1, exactly the materials with no alternative.
### Trap 2: order changes the text
The macro writes codes in pick order. SUP-1 and SUP-4 are approved together on three materials: one cell reads “SUP-1, SUP-4”, two read “SUP-4, SUP-1”. Matching the whole text with `=COUNTIF(B2:B181,"SUP-1, SUP-4")` finds 1. The SEARCH below ignores order and finds all three.
**Filtering and PivotTables.** I would expect a PivotTable to show the two spellings as separate rows, with no total per supplier. Add a helper column instead: `=--ISNUMBER(SEARCH(", SUP-1,",", "&B2&","))` in E2, filled down, shows 1 on the 41 SUP-1 rows; filter on 1. Build a per-supplier PivotTable from the link table in section 4.
### Correct count and code list: a SEARCH bounded by the separator
```
=SUMPRODUCT(--ISNUMBER(SEARCH(", SUP-1,",", "&B2:B181&",")))
```
“SUP-5, SUP-2, SUP-11” becomes ”, SUP-5, SUP-2, SUP-11,”, which does not contain ”, SUP-1,”. The result is 41. For codes rather than a count, in Microsoft 365 `=FILTER(A2:A181,ISNUMBER(SEARCH(", SUP-1,",", "&B2:B181&",")))` spills the 41 material codes, starting with MAT-002, MAT-007 and MAT-021. For a per-supplier count, put the codes in Summary!A2:A13 and `=SUMPRODUCT(--ISNUMBER(SEARCH(", "&A2&",",", "&Materials!$B$2:$B$181&",")))` in B2, filled down.
[According to Microsoft](https://support.microsoft.com/en-us/office/search-searchb-functions-9ab04538-0e55-4719-a72e-b6f54513b495), SEARCH accepts wildcards and ignores case; if codes contain `*` or `?`, or case matters, use FIND. A hand-typed “SUP-2,SUP-1” without the space does not match.
### Splitting a cell with TEXTSPLIT
`=TEXTSPLIT(B45,", ")` spills MAT-044’s cell (SUP-11, SUP-1, SUP-9) across three cells. [According to Microsoft](https://support.microsoft.com/en-us/office/textsplit-function-b1ca414e-4c21-4ca0-b1b7-bdecace8a6e7), TEXTSPLIT is available in Excel for Microsoft 365, Excel 2024 and their Mac versions; the page does not list Excel 2021 or earlier. The delimiter is the whole text; several delimiters need an array constant. `=COLUMNS(TEXTSPLIT(B2,", "))` in C2, filled down, gives each material’s supplier count: 52 materials show 1 and, suspension aside, depend on a single supplier.
### The lasting fix: give codes a fixed length
With SUP-01 instead of SUP-1 even the wildcard search would be right, since “SUP-01” is inside no other code. Pad new codes with zeros so none begins another; converting existing cells is in the FAQ.
## 4. Link table: one row, one approval
In a link table each row is one material–supplier pairing; MAT-044’s three approvals are three rows. Counting is a plain COUNTIF, section 3’s traps disappear, and each pairing carries its own approval date and approver.
- **Suppliers:** the `tblSupplier` table from section 1 (Code, Status).
- **Approvals:** A material, B supplier (single-select list, source `=SupplierList`), C approval date, D supplier status: `=VLOOKUP(B2,tblSupplier,2,FALSE)`.
- **Materials:** in column D, the number of active approved suppliers (enter in D2 and fill down): `=COUNTIFS(Approvals!$A$2:$A$351,A2,Approvals!$D$2:$D$351,"Active")`.
Approvals has 350 rows. Suspending SUP-1 is one cell: its status becomes “Suspended”. `=COUNTIF(Approvals!B2:B351,"SUP-1")` returns 41; exact match, so SUP-10 is not counted. `=FILTER(Materials!A2:A181,Materials!D2:D181=0)` lists the 11 materials with no active approved supplier left: MAT-021, MAT-031, MAT-043 and the rest.
The real difference shows with several suspensions. If quality also suspends SUP-2, a second cell changes and the same formula shows 15 materials. In comma-separated cells a wildcard-free COUNTIF has to search four spellings: “SUP-1”, “SUP-2”, “SUP-1, SUP-2” and “SUP-2, SUP-1”. Lifting a suspension is again one cell; if you deleted SUP-1 from comma-separated cells, the file no longer shows which 41 materials had it.
**Converting the existing comma-separated column (Microsoft 365, Excel 2024).** In A2 of an empty sheet:
```
=TEXTSPLIT(TEXTJOIN(";",TRUE,Materials!A2:A181&"|"&SUBSTITUTE(Materials!B2:B181,", ",";"&Materials!A2:A181&"|")),"|",";")
```
Each cell becomes “MAT-002|SUP-2;MAT-002|SUP-1”; all are joined, then split into 350 rows and 2 columns. Codes must not contain ”|” or ”;”; an empty B gives a row with no supplier. [According to Microsoft](https://support.microsoft.com/en-us/office/textjoin-function-357b449a-ec91-49d0-80c3-0e8fc845691c), TEXTJOIN returns #VALUE! if the joined text exceeds 32,767 characters; the example text is 4,938 characters. Before typing dates next to this formula output, fix it on Approvals with **Paste Special > Values** and add new pairings there row by row.
## Which route, when?
| Route | When | Limit |
| --- | --- | --- |
| VBA in one cell | Desktop Excel, short code list, the look matters | Not on the web or iOS; Ctrl+Z is lost |
| In-cell checkboxes | Microsoft 365, few and stable options | One column per option; no pairing details |
| Form control checkbox | A small entry screen | Check boxes not on the web; each box linked separately |
| Link table | Counting, suspensions, dates and status per pairing | No single-cell look, more rows |
| Form or web app | Orders prepared outside Excel, several roles | Needs setup and maintenance |
## 5. Where does a form or web app start?
Two numbers decide it: how long a suspension takes to reach the person preparing orders, and how many orders that supplier gets in that time. Multiply them. With assumed figures: noticed 3 working days late, 2 orders a day, so 3 × 2 = 6 orders may reach the suspended supplier. If the product is near zero, or a phone call reverses a wrong order, stay in Excel with section 4’s tables and a regular `=COUNTIF(Materials!D2:D181,0)` check. If the outcome can be an audit finding, a returned batch or a stopped line, the rule must apply when the order is entered.
Excel may manage this too. In Microsoft 365, on a single-row order entry area, spill the chosen material’s active suppliers into H2 with `=FILTER(Approvals!B2:B351,(Approvals!A2:A351=G2)*(Approvals!D2:D351="Active"),"")` and enter the spilled range with the `#` operator (`=$H$2#`) as the supplier field’s validation source; a suspended supplier then drops out. A plain `=$H$2` shows only the first. I found no Microsoft source for this and have not tested it. The real limit: orders prepared in an ERP, a purchasing program or an emailed copy of the file never see the suspension. If supplier status already lives in your ERP, keep it there; the question is whether the list moves into the ERP or the order screen connects to it.
Roles have a limit too. Sheet protection can lock Suppliers with a password, but anyone with the password can then edit, and it does not record who did. In Microsoft 365, [Show Changes](https://support.microsoft.com/en-us/office/show-changes-that-were-made-in-a-workbook-978ceea7-bbf6-4337-bca7-22e7cc9892e8) (Review > Show Changes) lists who changed what, where and when, for the past 365 days. Microsoft’s [Q&A answer](https://learn.microsoft.com/answers/a/12536321) says the file must be on OneDrive or SharePoint; not tested. It logs cell edits: it shows “Suspended” was typed, not that the suspension passed an approval step.
That is the point to consider a [multi-select related record form](https://oguzerol.com/en/multi-select-related-record-form/). Scope that could be built for this example: a suspension reaching order screens outside the file, and the ERP if needed, immediately; open requests flagged when quality suspends a supplier; the no-alternative list produced automatically; and approvals and suspensions recorded with who and when. The scope is set in writing at the first step. If an application is built, it runs on a virtual private server (VPS) that can be opened in your company’s name; the data is yours and you can export it to Excel or CSV whenever you like. For moving a whole spreadsheet, see [turning your Excel into a web app](https://oguzerol.com/en/turn-your-excel-into-a-web-app/).
If your approved supplier or certificate list sits in comma-separated cells and the numbers do not add up, send a few masked rows through the [contact page](https://oguzerol.com/en/contact/).
## Test these in your file first
Untested in Excel; check on a copy with a few rows:
- **The macro’s test steps,** especially step 4, and `RefersToRange` with a name pointing to a table column; also on a Mac.
- **Undo:** do steps before the macro also become impossible to undo?
- **Text from checkboxes:** does `FILTER(...,"")` return blank in a row with no box ticked?
- **Conversion formula:** as many rows as selections?
- **AutoFilter and PivotTable:** does Contains “SUP-1” return 72 rows, and does the PivotTable show “SUP-1, SUP-4” and “SUP-4, SUP-1” separately?
- **FILTER-based validation list:** is `=$H$2#` accepted as a validation source?
- **Show Changes:** in a OneDrive file, is a status change in the Suppliers table listed with who and when?
- **Sorting formula:** can TEXTSPLIT’s column delimiter be left empty?
## Frequently Asked Questions
### Can I sort the selections alphabetically inside the cell?
The macro can sort before writing `result`; otherwise, in Microsoft 365, put `=TEXTJOIN(", ",TRUE,SORT(TEXTSPLIT(B2,,", ")))` in a helper column: TEXTSPLIT spills the parts down a column, SORT orders them and TEXTJOIN joins them again. Text order puts SUP-10 before SUP-2.
### What if Excel 2019 has no TEXTSPLIT?
Counting does not need it; the bounded SEARCH works without it. For suppliers per cell, `=IF(B2="",0,LEN(B2)-LEN(SUBSTITUTE(B2,",",""))+1)` counts commas and adds one; it is right in all 180 example cells. For a link table, split the column by delimiter in Power Query with Split into: Rows under the advanced options ([Microsoft Learn](https://learn.microsoft.com/en-us/power-query/split-columns-delimiter)); then trim the leading space from each part.
### If I switch codes to the SUP-01 format, what happens to old comma-separated cells?
Find and Replace from “SUP-1” to “SUP-01” also turns “SUP-10” into “SUP-010”, and likewise SUP-11 and SUP-12, because every match inside a cell is replaced. Move to the link table first with section 4’s formula, then replace on the supplier column with **Match entire cell contents** ticked. Change the codes in `tblSupplier` too, or the dropdown offers old codes and VLOOKUP returns #N/A.
[Back to top ↑](https://oguzerol.com/en/excel-multi-select-dropdown/#icerik)