![]() |
|
#1
|
|||
|
|||
![]()
Or in A3 use (assumed the worksheet is never used at weekends, and you have to cope with state holidays otherwise)
Code:
=TODAY() - IIF(WEEKDAY(TODAY(),2)=1,3,1) |
#2
|
|||
|
|||
![]() Quote:
Also, I do need to deal with holidays. I'm not sure how to set up that hidden calendar. Your help is greatly appreciated. Thank you, Karen |
#3
|
|||
|
|||
![]() Quote:
For other workdays (from Tuesday to Friday, with weekday numbers from 2 to 5), the formula returns the date of previous workday (TODAY -1). As I declared in my precvious post, the formula in not meant to use at weekends. In case you want this formula to work when the workbook is opened at weekends (but ignoring holidays) too, you have to use instead Code:
=TODAY() - CHOOSE(WEEKDAY(TODAY(),2),3,1,1,1,1,1,2) Quote:
Add another column (e.g. column B with header "Weekday"), and fill it with weekday numbers using WEEKDAY() formula; Add another column (e.g. column C with header "Holiday"), and fill it with number 1 for every holiday in daterange of your table. When the date isn't a holiday, leave it empty, or enter 0; Add another column (e.g. column D with header "PreviousWD"). Based on info in columns B:C, fill this column with 0 when the date is workday and it is not a holiday. Otherwise enter, how many days back was last workday (1, or 2, or ... days). It is possible to create a formula for this column, but I'm afraid this will be too complex for you, and I don't have access to Excel currently, and even having it, the creating such formula will take hours for me too. Now either define this calendar table as Table with name like tCalendar, or select the whole datarange of created table, and define it as Name like nCalendar (I'll continue with defined Name below). On your original sheet, into cell A3 enter the formula like Code:
=(TODAY()-1) - VLOOKUP((TODAY()-1),nCalendar,4,0) After checking the formula for previous workday working, you can hide the sheet with calendar table you created. Last edited by ArviLaanemets; 11-22-2024 at 11:56 AM. |
#4
|
|||
|
|||
![]()
Thank you so much for your detailed reply! Your explanation is incredibly helpful, and I truly appreciate the time and effort you put into this. People on this site are amazing!
Happy holidays! |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Date Formula Issue | matteu1 | Mail Merge | 1 | 07-23-2018 04:53 AM |
Formula for looking at 1 cell with a date and then comparing it to four date ranges | LearningMom | Excel | 3 | 10-27-2017 12:44 PM |
![]() |
caz46 | Excel | 3 | 04-15-2015 08:59 AM |
![]() |
MPAVLAS | Excel | 3 | 08-12-2010 10:04 PM |