Excel formula to check date within this week and l

2019-09-01 10:52发布

Does anyone know an excel formula in which if the dates are within this week (Todays date) for the cells to read the text “this week” and if the dates are from the last week for the cells to read “last week”.

Ps: If the formula could also read "old" if the date range is not with this week or last week

Example: Column A has the following dates. I want column b to read whether or not the date is within this week or last week from today’s date.

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 

Big thanks to anyone who can solve this please.

标签: excel date
2条回答
神经病院院长
2楼-- · 2019-09-01 11:06

Just check if the difference between the week numbers

  • = 0 -> This week
  • = 1 -> Last week
  • >= 2 -> Old

Excel formula :

 =if( (WEEKNUM(now()) - WEEKNUM(A1)) < 0,
     "Future",
     if( (WEEKNUM(now()) - WEEKNUM(A1)) = 0, 
           "This Week", 
           if( (WEEKNUM(now()) - WEEKNUM(A1)) = 1,
                "Last Week",
                "Old"
           )
      )
  )
查看更多
混吃等死
3楼-- · 2019-09-01 11:24

Assuming first date in A2 try this formula in B2 copied down to give those results

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

....but as per my comment that puts 8 days in current week, is that right? If not then change both < to <=

查看更多
登录 后发表回答