跳到主要內容

 如何在Excel工作表的一個單元格中應用多個數據驗證?

在Excel工作表中,將一個數據驗證應用於一個單元格對我們來說可能很常見,但是,您是否曾經嘗試過在一個單元格中使用多個數據驗證? 本文中,我將討論一些用於解決Excel中此任務的不同示例。

在一個單元格中應用多個數據驗證(示例1)

在一個單元格中應用多個數據驗證(示例2)

在一個單元格中應用多個數據驗證(示例3)


在一個單元格中應用多個數據驗證(示例1)

例如,我想使用以下條件設置對單元格的數據驗證:如果輸入的數字必須小於100,如果輸入的文本必須在D2到D7的列表中,如以下屏幕截圖所示:

1。 選擇您要應用多個數據驗證的單元格,然後單擊 數據 > 數據驗證 > 數據驗證,請參見屏幕截圖:

2。 在 數據驗證 對話框中的 設定 選項卡,請執行以下操作:

(1.)選擇 習俗 來自 下拉列表;

(2.)輸入以下公式: =OR(A2<$C$2,COUNTIF($D$2:$D$7,A2)=1)公式 文本框。

備註:在以上公式中, A2 是您要應用數據驗證的單元格, C2D2:D7 是應用數據驗證所需要的標準。

3。 然後點擊 OK,從現在開始,只有符合條件的值可以輸入到單元格中,否則,將彈出一個警告提示框提醒您,請參見屏幕截圖:


在一個單元格中應用多個數據驗證(示例2)

在此示例中,我僅允許文本“ Kutools for Excel”或將12/1/2017到12/31/2017之間的日期輸入到特定的單元格中,如下圖所示。 要解決此工作,請按以下步驟操作:

1。 轉到 數據驗證 對話框,然後在對話框中執行以下操作:

(1.)點擊 設定 標籤;

(2.)選擇 習俗 選項從 下拉列表;

(3.)鍵入以下公式: =OR(A2=$C$2,AND(A2>=DATE(2017,12,1), A2<=DATE(2017,12,31))) 公式 文本框。

備註:在以上公式中, A2 是您要應用數據驗證的單元格, C2, 2017,12,12017,12,31 是應用數據驗證所需要的標準。

2。 然後點擊 OK 按鈕,現在僅允許輸入符合條件的值,其他值將受到限制,如以下屏幕截圖所示:


在一個單元格中應用多個數據驗證(示例3)

第三個示例,我希望文本字符串必須以“ KTE”或“ www”開頭,如果以“ KTE”開頭,則只能使用6個字符。 如果以“ www”開頭,則只能使用10個字符,請參見屏幕截圖:

數據驗證中的以下公式可以幫助您進行處理。

1。 去的 數據驗證 對話框中,在對話框中,請執行以下操作:

(1.)點擊 設定 標籤;

(2.)選擇 習俗 選項從 下拉列表;

(3.)鍵入以下公式: =OR(AND(LEFT(A2,3)="KTE",LEN(A2)=6),AND(LEFT(A2,3)="www",LEN(A2)=10))公式 文本框。

備註:在以上公式中, A2 是要應用數據驗證的單元格,您可以將公式中的條件更改為自己的條件。

2。 然後點擊 OK 按鈕,現在僅允許輸入與您指定的條件匹配的文本值,請參見屏幕截圖:

備註:可能需要應用其他不同的數據驗證標準,您可以根據需要為不同的標準創建自己的公式。

最佳辦公生產力工具

🤖 Kutools 人工智慧助手:基於以下內容徹底改變數據分析: 智慧執行   |  生成代碼  |  建立自訂公式  |  分析數據並產生圖表  |  呼叫 Kutools 函數...
熱門特色: 尋找、突出顯示或識別重複項   |  刪除空白行   |  合併列或儲存格而不遺失數據   |   沒有公式的回合 ...
超級查詢: 多條件VLookup    多值VLookup  |   跨多個工作表的 VLookup   |   模糊查詢 ....
高級下拉列表: 快速建立下拉列表   |  依賴下拉列表   |  多選下拉列表 ....
欄目經理: 新增特定數量的列  |  移動列  |  切換隱藏列的可見性狀態  |  比較範圍和列 ...
特色功能: 網格焦點   |  設計圖   |   大方程式酒吧    工作簿和工作表管理器   |  資源庫 (自動文字)   |  日期選擇器   |  合併工作表   |  加密/解密單元格    按清單發送電子郵件   |  超級濾鏡   |   特殊過濾器 (過濾粗體/斜體/刪除線...)...
前 15 個工具集12 文本 工具 (添加文本, 刪除字符,...)   |   50+ 圖表 類型 (甘特圖,...)   |   40+ 實用 公式 (根據生日計算年齡,...)   |   19 插入 工具 (插入二維碼, 從路徑插入圖片,...)   |   12 轉化 工具 (數字到單詞, 貨幣兌換,...)   |   7 合併與拆分 工具 (高級合併行, 分裂細胞,...)   |   ... 和更多

使用 Kutools for Excel 增強您的 Excel 技能,體驗前所未有的效率。 Kutools for Excel 提供了 300 多種進階功能來提高生產力並節省時間。  點擊此處獲取您最需要的功能...

產品描述


Office選項卡為Office帶來了選項卡式界面,使您的工作更加輕鬆

  • 在Word,Excel,PowerPoint中啟用選項卡式編輯和閱讀,發布者,Access,Visio和Project。
  • 在同一窗口的新選項卡中而不是在新窗口中打開並創建多個文檔。
  • 將您的工作效率提高 50%,每天為您減少數百次鼠標點擊!
Comments (15)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Hi,
I am capturing department (10 departments), rating (5,4,3,2 & 1)and reward type criteria (X, Y and Z) of which i calculate the overall callibration based on certain %. Eg. i have 10 departments having each department 15-20 employees. Now i need a formula wherein in the table against the particular department, lets say department1 to populate the % of employees (only with rating 5 and criteria X) against the total employee of (criteria X and Z).
This comment was minimized by the moderator on the site
I have data in two different columns and i have to apply this with two different criteria. For example, first criteria shows result if a particular cell contains a text "Highlighter" and second criteria show when the cell contain text "Pointer".
Highlighter test results are different than the pointer results and we make separate validation of both data. Is this possible to extract the validation of each criteria in a single cell with no overlapping?
This comment was minimized by the moderator on the site
Hey I want a parent child relationship sort of multiple drop down lists.
For example, if in column one some selects 'a' among the list of a, b & c
Then in the second column the child category of 'a' which is x, y & z should appear
How can that be done?
This comment was minimized by the moderator on the site
This comment was minimized by the moderator on the site
Hi Team, I failed to build example no.1. I copied and pasted the formula:  =OR(A2<$C$2,COUNTIF($D$2:$D$7,A2)=1) and failed. Where is the bug ? Can you please assist ? THX a lot.
This comment was minimized by the moderator on the site
Hello Frank,
Glad to help. The reason why the data validation failed is that you probably didn't choose the data validation cell range. Please select the cell range first (say A2:A10), then click Data > Data Validation > Data Validation to input the formula =OR(A2<$C$2,COUNTIF($D$2:$D$7,A2)=1). Please see the screenshots I uploaded here. Hope it can solve your problem. Have a nice day.
Sincerely,
Mandy
This comment was minimized by the moderator on the site
How can I apply a data validation to multiple columns?
This comment was minimized by the moderator on the site
Hello Fabian,To apple a data validation to multiple columns, the trick is almost identical to the ways we mentioned above. The most important thing is that you select the columns first, then you can set up the rules in the Data Validation dialog box. Plesase have a try. Any question, please feel free to contact us. Have a nice day.Sincerely,Mandy
This comment was minimized by the moderator on the site
i am confuse
This comment was minimized by the moderator on the site
Hi,
I need to validate multiple columns before entering a value into cell. please find my requirement below,
I have 3 columns for example,

A1-Total Credit limit (Mandatory field)
Should have a minimum amount of 100 and multiples of 100:
=AND(ISNUMBER(A1),A1>=100, MOD(A1,100)=0) - Solved!
B1- Weekly Credit limit (Optional filed)
User should be able to input a value only when A1 is filled, Should not be greater than A1, Minimum amount 100 and multiples of 100
=AND(A1<>"",ISNUMBER(B1),B1<=A1, MOD(B1,100=0) - Solved!
C1-Daily Credit limit (Optional field)
User should be able to input a value only when A1 is filled, Should not be greater than A1&B1, Minimum amount 100 and multiples of 100

I need to add following validation, Please Help
I have to check if A1 is filled or not, then C1 shouldn't be greater than A1 and C1 min value should be 100 and multiples of 100 - I have answer to this
How can add a validation on B1 because B1 is optional it can have value and cannot. so if there's a value I have to make sure C1 is not greater than B1 else ignore B1?

How can i have this in data validation?

Thanks once again for the help
This comment was minimized by the moderator on the site
how can I add another Data validation function with this list function. for example I added a list of "yes" and "no". but I also want to add an OR function to this so that if "yes" is selected in one column then others only have to be "no".
This comment was minimized by the moderator on the site
Is it possible to apply data validation on the calcuated column attribute?
This comment was minimized by the moderator on the site
i'm looking for the ability to have a data validation which allows the user to select multiple choices. I.e. the list pops up and user can select Apple, grape, and/or banana. If they select all three, it shows in cell as: "apple, grade, banana". if only 1: "grape" etc... any ideas?
This comment was minimized by the moderator on the site
Hello, jeffe,
Maybe the below article can help you to deal with your problem, please check it:
https://www.extendoffice.com/documents/excel/2448-excel-drop-down-list-multiple-selection.html
This comment was minimized by the moderator on the site
Any idea how to have multiple data validation and a drop down. Drop down uses "List" and this example uses "Custom". Basically if the correct data is present in another column, I want the drop down to be able to be selected to input data. Otherwise if the dropdown is selected the error message appears.
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations