Excel公式,用于检查本周和上周的日期

时间:2013-11-28 12:39:07

标签: excel date

有没有人知道一个excel公式,其中如果日期在本周(今天的日期)内,单元格可以读取“本周”的文本,以及日期是从上周查看单元格“上周” ”。

Ps:如果日期范围不是本周或上周,公式也可以读为“旧”

示例:A列具有以下日期。我希望b栏能够读取日期是否在今天或上周的日期之后。

Column A    Column B 

01/11/2013 - Old 

02/11/2013 - Old 

03/11/2013 - Old 

04/11/2013 - Old

05/11/2013 - Old

06/11/2013 - Old

07/11/2013 - Old 

08/11/2013 - Old

09/11/2013 - Old 

10/11/2013 - Old

11/11/2013- Old 

12/11/2013 - Old 

13/11/2013 - Old

14/11/2013 - last week

15/11/2013 - last week

16/11/2013 - last week

17/11/2013 - last week

18/11/2013 - last week

19/11/2013 - last week

20/11/2013- last week

21/11/2013 - This Week

22/11/2013 - This Week

23/11/2013 - This Week

24/11/2013 - This Week

25/11/2013 - This Week

26/11/2013 - This Week

27/11/2013 - This Week

28/11/2013 - This Week 

非常感谢能够解决这个问题的任何人。

2 个答案:

答案 0 :(得分:3)

假设A2中的第一个日期,请尝试将B2中的此公式复制下来以提供这些结果

=IF(A2<TODAY()-14,"Old",IF(A2<TODAY()-7,"last week", "This Week"))

....但根据我在本周提出8天的评论,是吗?如果没有,那么改变两者&lt;到&lt; =

答案 1 :(得分:0)

只需检查周数之间的差异

  • = 0 - &gt;本周
  • = 1 - &gt;上周
  • &gt; = 2 - &gt;老

Excel公式:

 =if( (WEEKNUM(now()) - WEEKNUM(A1)) < 0,
     "Future",
     if( (WEEKNUM(now()) - WEEKNUM(A1)) = 0, 
           "This Week", 
           if( (WEEKNUM(now()) - WEEKNUM(A1)) = 1,
                "Last Week",
                "Old"
           )
      )
  )