1. 程式人生 > 實用技巧 >excel建立下拉列表多選_如何在Excel中建立下拉列表?

excel建立下拉列表多選_如何在Excel中建立下拉列表?

excel建立下拉列表多選

excel建立下拉列表多選

Excel provides the drop-down list in order to provide multiple options to select one. The drop-down list can be created in different ways and options. In this tutorial, we will learn how to create a drop-down list for excel.

Excel提供了下拉列表,以便提供多個選項來選擇一個。 可以使用不同的方式和選項建立下拉列表。 在本教程中,我們將學習如何為excel建立一個下拉列表。

什麼是下拉列表? (What Is Drop-down List?)

The drop-down list provides multiple options where these options are selected from a list that works as a drop-down and select. The selected value or item will be set as the value for the drop-down list.

下拉列表提供了多個選項,可從用作下拉列表的列表中選擇這些選項並進行選擇。 所選值或專案將被設定為下拉列表的值。

建立下拉列表 (
Create Drop Down List)

As the drop-down list consist of multiple options or items of list we need some data source to provides as options in the drop-down list. So we will create a list which is countries in this example which contains, Turkey, UK, Germany, USA, China .We will also put a header for this list which is Items

. But using the header is optional.

由於下拉列表包含多個選項或列表項,因此我們需要一些資料來源作為下拉列表中的選項提供。 因此,在此示例中,我們將建立一個包含國家/地區的列表,其中包含Turkey, UK, Germany, USA, China 。我們還將在該列表的標頭中放置Items 。 但是使用標頭是可選的。

In order to use this list as the drop-down list source, we should convert them into a table. We can convert the list by selecting them and using CTRL+T shortcut. We are free to select the header Items but if we select it for conversion then we should express that the table has a header in the table creation dialog box.

為了將此列表用作下拉列表源,我們應該將它們轉換為表格。 我們可以通過選擇列表並使用CTRL+T快捷鍵來轉換列表。 我們可以自由選擇標題Items,但是如果選擇它進行轉換,則應在表建立對話方塊中表示該表具有標題。

Convert Items To Table
將專案轉換為表格

We can see the following screen which will convert given range items into a table. We will check the My table has headers checkbox if we selected the Item header cell.

我們可以看到以下螢幕,它將給定的範圍專案轉換為表格。 如果選擇了專案標題單元格,我們將選中“ My table has headers複選框。

Create Table From the Items
從專案建立表

We can see below that the items are listed inside the table as a table structure where items are colored accordingly. Also the header is colored more dark. We will use the following table in order to create the drop-down list.

我們可以在下面看到,表中列出的專案是作為表結構列出的,其中專案相應地帶有顏色。 標頭的顏色也更深。 我們將使用下表來建立下拉列表。

Drop-down List Source Table
下拉列表源表

Now we will start the drop-down list creation process. First we will select a cell where the drop-down list will be shown. In this case we select the D2 cell. Then we will open Data Validation from Data Tools menu.

現在,我們將開始下拉列表建立過程。 首先,我們將選擇一個顯示下拉列表的單元格。 在這種情況下,我們選擇D2單元。 然後,我們將從“ Data Tools選單中開啟“ Data Validation

Open Drop-down list Creation Dialog Box
開啟下拉列表建立對話方塊

Be low we can see the Data Validation screen where we will make some configuration. We will set the Allow: settings as List from the Settings tab. Ignore Blank will ignore blank cells of the table which is useful in most of the cases. In-cell drop-down will create the drop-down action and it must be selected. Source provides the range of the items we want to put into the drop-down list.

較低時,我們可以看到“ Data Validation螢幕,在此處進行一些配置。 我們將從“ Settings標籤中將“ Allow:設定設定為“ List SettingsIgnore Blank將忽略表的空白單元格,這在大多數情況下很有用。 In-cell drop-down將建立下拉選單操作,必須選中它。 Source提供了我們要放入下拉列表的專案範圍。

Configure Drop-down List Options
配置下拉列表選項

We can also provides some help information or message about the cell for better user experience. In the Input Message tab we can set some message about the drop down list. We will check the Show input message when cell is selected checkbox and put the Title and Input message values like below.

我們還可以提供一些有關該單元的幫助資訊或訊息,以提供更好的使用者體驗。 在Input Message選項卡中,我們可以設定一些有關下拉列表的訊息。 我們將選中“ Show input message when cell is selected複選框,然後Input messageTitle和“ Input message值,如下所示。

Drop-down List Configuration
下拉列表配置

When everything is completed we will click OK which will create our drop-down list in the cell D2. We will see the information title and message when we select the given drop-down list cell which is D2. We will also see a square button that will open the drop-down list and items to select.

一切完成後,我們將單擊OK,這將在單元格D2中建立下拉列表。 當選擇給定的下拉列表單元格D2時,我們將看到資訊標題和訊息。 我們還將看到一個方形按鈕,它將開啟下拉列表和要選擇的專案。

Drop-down List with Title and Message
帶有標題和訊息的下拉列表

We will see the following drop-down menu when we click it. All items are list which are Turkey, UK, Germany, USA, China

單擊它後,我們將看到以下下拉選單。 所有專案均列出了Turkey, UK, Germany, USA, China

Drop-down List Show
下拉列表顯示

When we select an option which is Germany, in this case, the value will be shown in the drop-down list cell. This can be very useful to select and read values for different multi-choice applications.

在這種情況下,當我們選擇一個選項(德國)時,該值將顯示在下拉列表單元格中。 這對於選擇和讀取不同的多項選擇應用程式的值非常有用。

Drop-down List Select Menu
下拉列表選擇選單

通過手動輸入資料建立下拉列表(Create Drop Down List By Entering Data Manually)

Another way to provides options to the Drop-down list is providing the data manually. Generally the drop-down options are provided as a table from other cells contents of the Excel. Alternatively we can provide the drop-down list items from the Data Validation dialog box. The process is the same with the creating drop-down list which is described previously. When we arrive the Data Validation dialog box in the source tab we will provide the data manually by separating them with comma. Comma is the separator to delimit drop-down list items.

為下拉列表提供選項的另一種方法是手動提供資料。 通常,從Excel的其他單元格內容中以表格形式提供下拉選項。 或者,我們可以從“資料驗證”對話方塊中提供下拉列表項。 該過程與前面所述的建立下拉列表相同。 當我們到達“源”選項卡中的“資料驗證”對話方塊時,我們將通過用逗號分隔資料來手動提供資料。 Comma是分隔列表項的分隔符。

Drop-down List with Manual Data
帶有手動資料的下拉列表

And all other settings and configurations are the same like table data as source.

所有其他設定和配置都一樣,例如表資料作為源。

LEARN MORE Python For Loop Tutorial With Examples and Range/Xrange Functions 瞭解更多有關帶示例和Range / Xrange函式的Python For Loop教程

通過使用Excel公式/函式建立下拉列表(Create Drop Down List By Using Excel Formulas/Functions)

Up to now, we have provides the drop-down list items like a table or manually. There is another alternative way to provide items for the drop-down list. We can provide the drop-down list items dynamically. We can use some functions in order to create drop-down list items.

到目前為止,我們提供了下拉列表項,例如表格或手動。 還有另一種方法可以為下拉列表提供專案。 我們可以動態提供下拉列表項。 我們可以使用一些功能來建立下拉列表項。

允許不存在的條目 (Allow Not Existing Entries)

By default a drop-down list provides the given items and only one of these items can be selected. No other value can be selected or entered into the drop-down list cell by default. If we need to accept optional values which are not presented in a drop-down list we should disable Show error alert after invalid data is entered checkbox and feature. This features is located in the Error alert tab of the Data validation dialog box like below. It can be change during a drop-down list creation or after the creation by editing the drop-down list properties.

預設情況下,下拉列表提供給定的專案,並且只能選擇這些專案之一。 預設情況下,無法選擇其他值或將其輸入到下拉列表單元格中。 如果我們需要接受下拉列表中未顯示的可選值,則應禁用Show error alert after invalid data is entered複選框和功能。 此功能位於“資料驗證”對話方塊的“ Error alert選項卡中,如下所示。 可以在建立下拉列表期間或在建立之後通過編輯下拉列表屬性來更改它。

Allow Not Existing Entries
允許不存在的條目

Below we can see that even Spain is not defined as an item of the drop-down list we have typed it into the cell manually.

在下面我們可以看到,甚至Spain也沒有定義為下拉列表中的一項,我們已經手動將其鍵入到單元格中。

Add Manual Data To Drop-Down List
將手動資料新增到下拉列表

新增/刪除專案(Add/Remove Items)

New items can be added into the drop-down list easily in different ways. One of the easiest ways is appending the new item into the end of the current source table of the drop-down list. We will add Spain in this example down China which an item of the table. The table will be automatically extended and Spain is added as an item in the drop-down list.

可以通過不同方式輕鬆地將新專案新增到下拉列表中。 最簡單的方法之一是將新專案附加到下拉列表的當前源表的末尾。 在此示例中,我們將在中國下表中新增西班牙。 該表將自動擴充套件,並且西班牙作為下拉列表中的項新增。

Add/Remove Items
新增/刪除專案

刪除下拉列表(Remove Drop-down List)

We can remove or delete a drop down list from the Data Validation dialog box. First we will select the cell of the drop-down list. Then we will open the data validation dialog box.

我們可以從“資料驗證”對話方塊中刪除或刪除下拉列表。 首先,我們將選擇下拉列表的單元格。 然後,我們將開啟資料驗證對話方塊。

Then in the settings tab we will click to the Clear All button which will clear the source. Alternative we can clear the source with the backspace or delete.

然後,在設定選項卡中,我們將單擊“ Clear All按鈕,這將清除源。 或者,我們可以使用退格鍵清除原始碼或刪除原始碼。

Clear Source Content
清除源內容

After clearing the source content it will look like below as we can see that the Allow setting is any value and data setting is disabled. The last step is clicking OK to apply this setting.

清除源內容後,如下所示,因為我們可以看到“允許”設定為任何值,並且資料設定被禁用。 最後一步是單擊“ OK以應用此設定。

Remove Drop-down List
刪除下拉列表

從屬/巢狀/多級下拉列表(Dependent/Nested/Multi Level Drop-down List)

Drop-down list can be created in a dependent or nested or multilevel way. All of the same which is simply selected item of the first drop-down list will change the second drop-down item list. This is a hierarchical way. The fist drop-down list is also called parent drop-down list and the second drop-down list is called child drop-down list. Actually dependent drop-down list can be implemented for more than 2 levels like 5 or 10 levels where every child depends its parent selection.

可以以相關或巢狀或多級方式建立下拉列表。 只要是第一個下拉列表的簡單選擇項,所有這些都將更改第二個下拉列表。 這是一種分層方式。 第一下拉列表也稱為父下拉列表,第二個下拉列表稱為子下拉列表。 實際上依賴的下拉列表可以實現2個以上的級別,例如5或10個級別,其中每個孩子都取決於其父級選擇。

LEARN MORE C - Arrays 瞭解更多C-陣列

翻譯自: https://www.poftut.com/how-to-create-a-drop-down-list-in-excel/

excel建立下拉列表多選