在Excel中分类天数?

时间:2017-07-11 19:42:56

标签: excel excel-formula

我正在寻找一种方法来将一周中的几天分类为周末或工作日。我目前在excel表中有一个列如下:

    Days
    Monday 
    Tuesday 
    Sunday
    Friday 

我的目标是在上表旁边创建一个列,如下所示:

    Days    Type
   Monday  Weekday 
   Tuesday Weekday 
   Sunday  Weekend
   Friday  Weekday 

有没有办法可以用公式或其他东西来完成这个过程?我无法手动执行,因为有数百行。我不能使用附加组件,因为它们被我的工作阻止,而且只是下载附加组件的漫长过程。

5 个答案:

答案 0 :(得分:2)

如果天数在A1中向下,则将此公式放在B1中并向下复制

=IF(MATCH(A1, {"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"}, 0) < 6, "Weekday", "Weekend")

答案 1 :(得分:2)

= IF(OR(A1 = “星期一”; A1 = “星期二”; A1 = “星期三”; A1 = “星期四”; A1 = “星期五”); “平日”, “周末”)

答案 2 :(得分:2)

使用 A1 中的数据,在 B1 中输入:

=LOOKUP(A1,{"Friday","Monday","Saturday","Sunday'","Thursday","Tuesday","Wednesday"},{"weekday","weekday","weekend","weekend","weekday","weekday","weekday"})

enter image description here

注:

公式中的天数按字母顺序排列。

答案 3 :(得分:2)

另外三个,

=choose(iferror(sign(match(a1, {"Saturday","Sunday"}, 0))+1, 1), "Weekday", "Weekend") 

=choose(isnumber(match(a1, {"Saturday","Sunday"}, 0))+1, "Weekday", "Weekend")

=choose(or(a1={"Saturday","Sunday"})+1, "Weekday", "Weekend")

答案 4 :(得分:0)

我个人更喜欢Jeeped的方法。但这里还有另外两个:

=IF(OR(A2={"Saturday","Sunday"}),"Weekend","Weekday")

如果你真的讨厌打字:

="Week"&IF(OR(A2={"Saturday","Sunday"}),"end","day")