# Date calculation question

#### tigger2

##### New Member
I am trying to use a date function in a formula and not sure what I'm doing wrong:

=IF(H11=0,DATE(2004,1,31)-L11,J11)

BAsically the formula says if H11 (response date) is 0, calculate the number of days between today and the due date; otherwise use the value of H11 - the response date.

I tried TODAY, NETWORKDAYS, DATE - I'm sure I"m missing an argument or something but am not very familiar with date functions.

Any ideas would be appreciated.

### Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

#### boxsterman

##### Active Member
What are you getting as a response in your formula?

#### north19701

##### Active Member
=IF(H11=0,TODAY()-L11,J11)

is this what you're looking for?

#### tigger2

##### New Member
That works - thanks. I see I didn't have the () with TODAY.

Thanks again.

#### gaynard_nelson

##### Active Member
tigger2 said:
I am trying to use a date function in a formula and not sure what I'm doing wrong:

=IF(H11=0,DATE(2004,1,31)-L11,J11)

BAsically the formula says if H11 (response date) is 0, calculate the number of days between today and the due date; otherwise use the value of H11 - the response date.

I tried TODAY, NETWORKDAYS, DATE - I'm sure I"m missing an argument or something but am not very familiar with date functions.

Any ideas would be appreciated.

This works for me. If
H11=15
J11=30
L11=3/1/2004

Then this formula displays

30 as the answer

=IF(H11=0,TODAY()-L11,J11)

Excel will try to format this formulas cell as a date, since it is working with cells that have dates in them. You need to format this formulas cell for General, so it will display the answer in days.

Replies
1
Views
59
Replies
5
Views
271
Replies
8
Views
205
Replies
12
Views
211
Replies
7
Views
152

1,186,365
Messages
5,957,445
Members
438,306
Latest member
Crystal_Blue

### 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.
Allow Ads at MrExcel

### Which adblocker are you using?

Follow these easy steps to disable AdBlock

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

### Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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