Hi Rob!
It's difficult without being able to test on your workbook but here's
what I get:
=IF(E5="","",ROUNDDOWN((LOOKUP(G2,IF(K5="",$E$5:$E$38,$L$5:$L$37))-(D5
-1)/7),0)&" weeks
"&MOD(LOOKUP(G2,IF(K5="",$E$5:$E$38,$L$5:$L$37))-(D5-1),7)&" days")
Your lookup vector varies according to K5 = or <> "" so I put the IF
function regarding K5 into the lookup vector argument.
Your use of DATEDIF isn't really necessary as End_Date-Start_Date
returns days.
I've made the references to the lookup vectors absolute. It's a habit
because these formulas are often copied down and you don't want the
vector to change.
I think that your D5 and K5 references might need to be made absolute
as well.
I added a couple of spaces to your labels for cosmetic purposes.
But it needs testing as changes in this way without the workbook are
bound to produce problems. If it doesn't, then the beers are on me! I
just hate changing and playing around with formulas without a test.
DATEDIF has been an Excel built in function since way back when but
only made an appearance in Help in Excel 2000. Probably the best help
page is:
http://www.cpearson.com/excel/datedif.htm
Generally on complex formula building, I'd use John Walkenbach's
Megaformula technique to build up, test and make more efficient the
various options.
--
Regards
Norman Harker MVP (Excel)
Sydney, Australia
(e-mail address removed)
Excel and Word Function Lists (Classifications, Syntax and Arguments)
available free to good homes.