Link to home
Start Free TrialLog in
Avatar of route217
route217Flag for United Kingdom of Great Britain and Northern Ireland

asked on

date formula using network days

Hi Experts excel 2007

Need a date formula in cell c2 to do the following if cells a2 and b2 have date's.

If cell a2 has a date and b2 is blank the in c2 add 7 days
If cell b2 has date and a2 is blank the b2.nj
Avatar of Naresh Patel
Naresh Patel
Flag of India image

try this
=TEXT(IF(AND(CELL("Format",A2)="D1",B2=""),A2+7,IF(AND(CELL("Format",B2)="D1",A2=""),B2,"")),"dd/mmm/yyyy")

Open in new window


Thanks
Avatar of Rgonzo1971
Rgonzo1971

What do you mean by

the b2.nj


Regards
Avatar of route217

ASKER

Hi itjockey

I have yo apologies. ...made an error...can we correct formula,  please.

If a2 has a date and b2 is blank then a2 + 7 networkdays
If a2 is blank and b2 has a date then b2
Finally
If a2 has a date and b2 has a date then b2.
if you want to exclude weekend days in criteria 1 then use this
=TEXT(IF(AND(CELL("Format",A2)="D1",B2=""),A2+((7-(NETWORKDAYS(A2,A2+7)))+7),IF(AND(CELL("Format",B2)="D1",A2=""),B2,"")),"dd/mmm/yyyy")

Open in new window

ok give me one moment as I dint refresh browser ...your comment I see after I posted.
=TEXT(IF(AND(CELL("Format",A2)="D1",B2=""),A2+((7-(NETWORKDAYS(A2,A2+7)))+7),IF(AND(CELL("Format",B2)="D1",A2=""),B2,"")),"dd/mmm/yyyy")

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Naresh Patel
Naresh Patel
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
do u want me to combine condition 2 & 3 in one statement ?as both way outcome is B2.

Thanks
Excellence excellent. .
Thank You