# Difference between dates using IF and TODAY...stuck!

#### Related1

##### New Member
Hi!

I have two columns. If there is a date in the first column, and no date in the second column I would like the second column to be today's date and then continue with my formula to determine the number of days between the two dates.

=networkdays(E14, F14,Holidays!\$A\$2:\$A\$15).

If there is no date in the first column, a blank can be returned.

Honestly, I was impressed with myself that I figured out the second part which works when there are dates but I always have a hard time connecting/nesting functions.

Thanks for any help!

### Excel Facts

Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

#### Sufiyan97

##### Well-known Member
Try
Excel Formula:
``=IF(E14="","",IF(F14="",TODAY()-NETWORKDAYS(E14,F14,\$A\$2:\$A\$15),NETWORKDAYS(E14,F14,\$A\$2:\$A\$15)))``

#### Related1

##### New Member
Hi! Thanks for the help. When you see it written out it makes so much more sense.

I used =IF(E52="","",IF(F52="",TODAY()-NETWORKDAYS(E52,F52,Holidays!\$A\$2:\$A\$15),NETWORKDAYS(E52,F52,Holidays!\$A\$2:\$A\$15))) based off of your suggestion and I received this?

But I copied it directly and added 'Holidays' which is the name of the sheet that contains A2:A15.

The cells in column G are formatted as follows:

My assumption is that I did something wrong!

#### Sufiyan97

##### Well-known Member
Try

Excel Formula:
``=IF(E52="","",NETWORKDAYS(E52,IF(F52="",TODAY(),F52),Holidays!\$A\$2:\$A\$15))``

#### Related1

##### New Member
YES!!!! Do you mind explaining how this worked and why the other one didn't? I'd like to learn.

THANK YOU.

#### Sufiyan97

##### Well-known Member
YES!!!! Do you mind explaining how this worked and why the other one didn't? I'd like to learn.

THANK YOU.
Sure

I made a mistake in previous formula
Below part of formula is totally wrong because in F52 is blank then it will deduct TODAY from start date

=IF(E52="","",IF(F52="",TODAY()-NETWORKDAYS(E52,F52,\$A\$2:\$A\$15),NETWORKDAYS(E52,F52,\$A\$2:\$A\$15)))

and because we already deduct F52 (end date) here =NETWORKDAYS(E52,F52,\$A\$2:\$A\$15)

It gives -31769 and if we deduct it from TODAY's date which is 44539 in (General Format)
It gives 76308

If you put below formula only and deduct it from today's date then you will get an idea that what happens

=NETWORKDAYS(E52,F52,\$A\$2:\$A\$15)

Hope this helps!

#### Related1

##### New Member
Yes, it totally helps and makes sense. I like following the logic on how you discovered the mistake!

Thanks again!

#### Sufiyan97

##### Well-known Member
You're Welcome!
Glad I was able to help!

#### Related1

##### New Member

I have one more request

How would I also add an IF where if there are two dates there - I do NOT need the calculation? (It's calculated in another column).
Formula used =IF(E12="","",NETWORKDAYS(E12,IF(F12="",TODAY(),F12),Holidays!\$A\$2:\$A\$15))

So if there are two dates in E12 and F12, return " ".

Is this possible?

Thanks.

#### Fluff

##### MrExcel MVP, Moderator
Excel Formula:
``=IF(AND(E12<>"",F12<>""),"",IF(E12="","",NETWORKDAYS(E12,IF(F12="",TODAY(),F12),Holidays!\$A\$2:\$A\$15)))``

Replies
1
Views
1K
Replies
3
Views
226
Replies
2
Views
242
Replies
0
Views
299
Replies
3
Views
137

1,195,948
Messages
6,012,475
Members
441,701
Latest member
vnkendijs

### 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