# Excel date and forumula problems

#### Robbeh

##### New Member
Hello,

I'm having two problems with Excel, it's quite hard to explain as I can't show you the file - but here goes!

In field E4 I have a date (ie 20/01/2004) , and in D4 I have a number of days (ie 2).

The date is a deadline for a task, and the number of days is how long it's going to complete that task - so, in cell F4, I'm trying to calculate when we need to start the task (ie E4-D4). The problem with that is that it doesn't take into account weekends - so to get to my problem, is there a way of making it take into account weekends, and change my value of F4 to include them (so it'll move the start task date forward).

Secondly - is there a way to make it so that if there is no value in D4 (ie we havent said how long something is going to take) it doesnt calculate the figure (I guess there's some kind of if test?). I've tried to do this using conditional formatting, but this is no good because although it can hide data by making it the same colour as the background the data shows up when I create a pivot table from the data.

I would really appreciate any help that anyone could give me, thank you very much indeed for your time

### Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.

##### MrExcel MVP
=WORKDAY(E4,-D4,Holidays)

where Holidays refers to a range housing the holiday dates.

#### DonkeyOte

##### MrExcel MVP
=IF(D4="","",WORKDAY(E4,-(D4),Holidays))

The great man got there first

#### Robbeh

##### New Member
Hello,

I'm afraid I don't quite understand - could you go in baby steps please!

I've managed to define a range of dates which house all the weekends and bank holidays for this year and called it 'Holidays', but when I put in that formula I get an error.

Thank you so much once again for your help!

##### MrExcel MVP

Robbeh said:
Hello,

I'm afraid I don't quite understand - could you go in baby steps please!

I've managed to define a range of dates which house all the weekends and bank holidays for this year and called it 'Holidays', but when I put in that formula I get an error.

Thank you so much once again for your help!

Holidays should only list the bank holiday dates, not the weekends, because WORKDAY automatically takes care of weekend dates.

#### Robbeh

##### New Member
Wow that's clever of it!

I'm sorry, I'm probably being very stupid, but I get an error that says "Invalid name error", the value displayed in the cell is #NAME?

Is that because I've done something stupid!

Again guys, I can't thank you enough, you're really getting me out of a hole!

#### Robbeh

##### New Member
I'm sorry, I didnt have a necessary bit of excel installed.
You guys got it right - thank you so much, my pivot table now works fantastically!!

Thank you once again, I owe you all one.

Replies
4
Views
658
Replies
11
Views
454
Replies
1
Views
286
Replies
5
Views
112
Replies
2
Views
440

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

1,152,100
Messages
5,768,091
Members
425,452
Latest member
htay44

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back