Home » excel » excel – How to subtract from a specific date and have it land on a weekday while counting weekend days in the subtraction?

excel – How to subtract from a specific date and have it land on a weekday while counting weekend days in the subtraction?

Posted by: admin May 14, 2020 Leave a comment

Questions:

So my question is how do I subtract from a specific dates, while counting weekends and having the end result land on a weekday. For example: If I have a dates in Column F and I have subtractions/additions in columns B-E

Column B Subtracts 36 Days

Column C Subtracts 21 Days

Column D Adds 7 Days

Column E Subtracts 11 Days

If in Column F for example is 1/26/2020 The Columns according to the equations above would equal:

B - 12/21/2019

C - 1/5/2020

D - 2/2/2020

E - 1/15/2020

What I would like the formula to do is, if it lands on a Saturday subtract 1 and land on a Friday and if it lands on Sunday add 1 and land on Monday so the result would look like the following:

B - 12/20/2019

C - 1/6/2020

D - 2/3/2020

E - 1/15/2020

I have tried doing WORKDAY formula but gives me incorrect dates if I keep the equations above. Is there a way to write a formula that would still count WEEKENDS (Saturday & Sunday are considered Weekends in this example) and be able to land on Friday instead of Saturday and land on Monday instead of Sunday

Any help would be much appreciated!!

How to&Answers:

To illustrate how to work the formula, I set up the test data in a manner similar to your description.

enter image description here

The formulas in row 2 are simply:

          Column B        Column C        Column D        Column E
Row 2:    =$F$2+B1        =$F$2+C1        =$F$2+D1        =$F$2+E1
Row 3:    =WEEKDAY(B2,1)  =WEEKDAY(C2,1)  =WEEKDAY(D2,1)  =WEEKDAY(E2,1)

In order to make the difference calculation avoid the weekend, you’ll have to use an IF statement. So in my example data, cell B5 holds the formula:

=IF(WEEKDAY($F$2+B$1)=7,($F$2+B$1)-1,IF(WEEKDAY($F$2+B$1)=1,($F$2+B$1)+1,($F$2+B$1)))

Answer:

A little bit simpler formula:

=((A1+A2)-(WEEKDAY(A1+A2,1)=7)+(WEEKDAY(A1+A2,1)=1))

enter image description here

Answer:

B2: =$F2+B$1+CHOOSE(WEEKDAY($F2+B$1,16),-1,1,0,0,0,0,0)

enter image description here

Answer:

In B2, a shorter formula copied across right :

=B$1+$F2+TEXT(MOD(B$1+$F2,7)-1,"
=B$1+$F2+TEXT(MOD(B$1+$F2,7)-1,"\0;-1;1") 
;-1;1")

enter image description here