Hi,
I am trying to create a formula that gives me the WORKDAY that occurs on, or before the 25th of the month. I have to pay salaries on this date and it will be earlier if the 25th happens to fall on a weekend.
Thanks,
Craig.
Hi,
I am trying to create a formula that gives me the WORKDAY that occurs on, or before the 25th of the month. I have to pay salaries on this date and it will be earlier if the 25th happens to fall on a weekend.
Thanks,
Craig.
Given the 25th of the month as an input in cell A1,
B1 will take that, and subtract 1 day if it happens to be a Saturday, and 2 days if it happens to be Sunday, and return the corresponding date.
A1 = date_input
B1 = A1 - MAX(0, WEEKDAY(A1, 3) - 4)
The method is, WEEKDAY() returns 0 for Monday, 1 for Tuesday, ... 6 for Sunday, when we use "3" as the second term ("1" and "2" return different numbers); so we subtract 4, which makes Friday 0, Saturday 1, and Sunday 2; and if that's more than zero, it's subtracted from the date.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks