# How do I fill weekdays on a calculated cell?

I'm trying to autofill cells to exclude weekends. The thing is, the date is calculated and the context menu for fill weekdays is grayed out because of it.

So basically I'm trying to say something like `date = B1+C1` unless that's a weekend day, in which case move to the nearest Monday. So for instance

``````Thursday(B1) + 2 = Monday
``````

Any ideas?

UPDATE:

Here is the table. As you can see, I am trying to add days to the start day to determine a stop date. I'm using Start day + duration = finish date, then finish date + 1 for the next start date. When I add the estimated time to the start day it needs to not count weekends as days.

-

## 2 Answers

``````=IF(WEEKDAY(C2+B2, 2)>5, C2+(8-WEEKDAY(C2,2)), C2+B2)
``````

This will convert any date falling on Saturday or Sunday to the next Monday leaving the rest of the week work unchanged. It will add Saturday and Sunday to the calculation.

EDIT:

If you only want work days (Monday thru Friday) the formula is much simpler. This will add up the workday between the start days and the number of days to complete.

``````=WORKDAY(C2,B2)
``````
-
This was seeming to work but then broke. I updated the post with an image. As you can see, everything was going well until row 5. All of a sudden 5 days after the 15th was the 16th O_o. If you could have the formula match this table, i might be able to better understand what's happening. Right now, what I put in the first cell was =IF(WEEKDAY(C2,2) + 1 >5, C2+(8-WEEKDAY(C2,2)) + 1, C2 + 1) – Sinaesthetic Aug 7 '12 at 14:24
move the +1 inside the parenthesis with c2. Weekday(c2+1,2). it should fix your issue – wbeard52 Aug 7 '12 at 15:15
same result, different days :/ – Sinaesthetic Aug 7 '12 at 17:37
using this, I put `=WORKDAY(C2,B2)` into D2, and `=WORKDAY(D2,1)` into C3, and copied the cells does to the end of the table. It gave me all correct dates: imgjoe.com/x/kjlfvgaijaer.jpg – SeanC Aug 9 '12 at 18:23
Glad you got it. If this is the correct answer please accept it. – wbeard52 Aug 9 '12 at 19:41

The syntax for the Weekday function is:

``````Weekday( serial_number, return_value )
``````

Based on the return value you can add 1 or 2 days.

-