文、意如
任務1:製作下拉式選單
1.1準備下拉式選單的值
1.2下拉式選單製作
任務2:表單驗證
2.1當儲存格被選取時,顯示提示輸入的訊息
2-2購買數量大於庫存量時,需跳題示訊息
每次讓使用者輸入商品實在太不合理,也會有輸入錯誤的可能,所以商品欄位需要改成下拉式選單。如下圖:

另外,輸入購買數量時,大於庫存量時需顯示提示訊息。
任務1:製作下拉式選單
1.1準備下拉式選單的值
先在空白的地方輸入你想要下拉式選單出現的值有哪些,例如:商品A、商品B等…

1.2下拉式選單製作
1.點選B2儲存格
2.工具列->資料
3.資料驗證

接下來到資料驗證的設定
1.設定
2.點選儲存格內允許:下拉式V
3.選擇清單

接下來把滑鼠游標放置來源區

1.選擇我們需要的下拉式選單的值F2:F6
2.確認來源是否已自動填上=$F$2:$F$6
3.按下確認

再次點選B2,你會發現下拉式選單已經完成了。

任務2:表單驗證
2.1當儲存格被選取時,顯示提示輸入的訊息
提示使用者要輸入的值是什麼,例如提示使用者要輸入的是姓名。

1.首先點選A2儲存格
2.工具列->資料
3.資料驗證

接下來到資料驗證的輸入訊息
1.輸入訊息
2.當儲存格被選取時,顯示輸入訊息
3.輸入標題
4.輸入訊息
5.確定

接著點選A2儲存格,則會跳出剛輸入的提示訊息

2-2.購買數量大於庫存量時,需跳提示訊息

首先輸入商品庫存D欄,接著點選C2儲存格來設定讓這一個儲存格只能小於或等於庫存,否則就會跳警告視窗。
C | D | |
1 | 購買數量 | 庫存 |
2 | 10 | |
3 | 35 | |
4 | 16 |
1.點選C2儲存格
2.資料
3.設定
4.儲存格內允許:“整數”

接下來點選資料“小於或等於”

接著最大值則等於庫存D2儲存格

設定好儲存格的值後,就要來設定錯誤提示訊息了,所以切到”錯誤提醒”頁籤,”輸入的資料不正確時顯示警訊”前方打V

這邊錯誤提醒的樣式有三個,分別是資訊、警告、停止

介紹樣式之前,我們先把提醒的標題跟訊息內容先輸入上去。如下:
標題:庫存量不足
訊息內容:購買數量應小於庫存量

接下來介紹一下樣式,如果我們選擇的是”資訊”

當我們購買數量超過庫存的時候,它會已資訊的方式通知我們,按下確定後,儲存格仍然可以接受購買數量超過庫存的這個值。

而第二種樣式”警告”

當購買數量大於庫存時,跳出的警告視窗,會詢問你是否要繼續,如果點選否的話會讓你重新輸入數值,如果按是的話,則會保留你原本輸入的值。所以,這個樣式仍然可以接受你的值。

最後一種樣式”停止”

當購買數量大於庫存時,跳出的提示視窗就很強硬了,除非你輸入符合規定的值,否則將無法存入你的值。

所以這三種樣式,都可以依照資料自己的需求而去做設定,以我們的範例來說,數量一定不能大於庫存,所以使用”停止”不讓使用者輸入不符合的值,資料才會較符合我們要的格式。
相關文章:
[Excel]-職場使用頻率最高的VLOOKUP、HLOOKUP函數詳解
[Excel]-最新函數XLOOKUP取代VLOOKUP、HLOOKUP?
[Word][Excel]使用Word結合Excel做報表
[Excel]-圖片快速去背、插入背景圖片
Yiru@Studio - 關於我 - 意如