2011年4月20日 星期三

Excel-產生骰子的六種點數

在 Excel 中,如果想要製作一個骰子的六個面(有六種點數),該如何處理呢?下圖紅色部分代表六種點數。

參考以下的範例,點數位於儲存格B1中:

儲存格B1:=RANDBETWEEN(1,6),藉以產生1~6的數字。

儲存格B2:=CHOOSE(B1,"","●","●","●","●","●")

儲存格D2:=CHOOSE(B1,"","","","●","●","●")

儲存格B3:=CHOOSE(B1,"","","","","","●")

儲存格C3:=CHOOSE(B1,"●","","●","","●","")

儲存格D3:=CHOOSE(B1,"","","","","","●")

儲存格B4:=CHOOSE(B1,"","","","●","●","●")

儲存格D4:=CHOOSE(B1,"","●","●","●","●","●")

根據儲存格B1的數字,對照是否要顯示「●」,否則顯示空白。

如何儲存格B2中的數字不會顯示出來呢?其實只要設這個儲存格的數值格式為「;;;」(三個分號),儲存格中的數字即不會顯示出來。只要每按一下 F9 鍵,亂數值即會修改。

沒有留言:

張貼留言

好康東東