LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default Formula for # weeks between 2 dates

I am writing a formula to calculate the number of weeks between two date
fields. Easy enough, =(Date2-Date1)/7. Problem is that not all date fields
have a value and sometimes the two date fields are the same. Here are the
possibilities and the desired result:
Date1 Date2 Result
Null Null Null
x y (y-x)/7
x x 0.14
x Null (Today()-x)/7

Here is what I have right now:

=IF(AND(Date1="",Date2=""),"",IF(AND(Date10,Date2 0),IF(Date1=Date2,"0.14",(Date2-Date1)/7),IF(AND(Date2="",Date10),((TODAY()-Date1)/7))))

Everything seems to work except for when Date1 has a value and Date2 does
not. I get #VALUE! in that case. I tried messing with the perens around the
today() part of the formula but can't seem to get it working.

I am using Excel 2002. Many thanks.

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Difference in Weeks between 2 dates Grd Excel Worksheet Functions 2 April 11th 07 03:56 PM
Weeks and dates c991257 Excel Worksheet Functions 1 July 21st 06 04:05 PM
Converting Dates to Weeks Kurt Excel Worksheet Functions 10 July 21st 06 09:23 AM
Subtracting dates into weeks... Lucy Excel Discussion (Misc queries) 3 May 26th 06 07:51 PM
Weeks between dates BobbiA Excel Worksheet Functions 3 August 10th 05 08:17 PM


All times are GMT +1. The time now is 02:24 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"