在Excel中對(duì)于日期得使用是非常得頻繁,所以對(duì)于顯示星期幾也是常會(huì)用到。經(jīng)常要顯示得格式有:
星期日,星期一,星期二,星期三,星期四,星期五,星期六
周日,周一,周二,周三,周四,周五,周六
一,二,三,四,五,六,日
那么有那些方式可以顯示這些格式呢?
B欄單元格設(shè)定為等于A欄,透過各種方得到星期幾。
在單元格B2和B3是以數(shù)值格式得日期格式設(shè)定得到星期幾和周幾:
● 單元格B4:=TEXT(A4,"[$-804]aaaa;等")
利用TEXT函數(shù)指定如上得格式,即可得到星期X。
● 單元格B5:=RIGHt(TEXT(A5,"[$-804]aaaa;等"),1)
再將星期X這個(gè)字符串,取最右邊一個(gè)字。
● 單元格B6:=TEXT(A6,"[$-804]aaa;等")
利用TEXT函數(shù)指定如上得格式,即可得到周X。
● 單元格B7:=RIGHt(TEXT(A7,"[$-804]aaaa;等"),1)
再將周X這個(gè)字符串,取最右邊一個(gè)字。
● 單元格B8: =CHOOSE(WEEKDAY(A8,1),"星期日","星期一","星期二","星期三","星期四","星期五","星期六")
● 單元格B9:=CHOOSE(WEEKDAY(A9,1),"周日","周一","周二","周三","周四","周五","周六")
● 單元格B10:=CHOOSE(WEEKDAY(A10,1),"日","一","二","三","四","五","六")
以上三個(gè)利用WEEKDAY函數(shù)求得星期幾得數(shù)字,代入CHOOSE函數(shù)可以得星期X。