Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
dstock
 
Posts: n/a
Default Simple question: Difference between two dates?


Suppose cell A2 has 6/27/05 - 7/1/05
A3 has 7/4/05 - 7/8/05... and so
I need to know the formula to coomputer the number of days between
those dates, which is obviously 5. The reason it need to keep the range
in one cell is this will be used in a VLookup function. Thanks!


--
dstock
------------------------------------------------------------------------
dstock's Profile: http://www.excelforum.com/member.php...o&userid=24225
View this thread: http://www.excelforum.com/showthread...hreadid=381328

  #2   Report Post  
TomHinkle
 
Posts: n/a
Default

Anyway you slice it, you have to get the 2 dates seperated...

So you can have one column that shows them together for the VLookup '6/27/05
- 7/1/05' and 2 more for the first and second dates...

OR you can write some tricky VB code to parse out the dates from the string,
then do the 'date arithmatic' to find your value.

I would choose the multiple column method.. Keeps the logic more straight
forward and reduces custom code. If you're concerned about redundancies or
extra columns, extra columns can be hidden AND remember, excel is NOT a data
management tool (like a database) it's a tool for analysis. (ie not really
designed to 'normalize' all the data.

HTH

"dstock" wrote:


Suppose cell A2 has 6/27/05 - 7/1/05
A3 has 7/4/05 - 7/8/05... and so
I need to know the formula to coomputer the number of days between
those dates, which is obviously 5. The reason it need to keep the range
in one cell is this will be used in a VLookup function. Thanks!


--
dstock
------------------------------------------------------------------------
dstock's Profile: http://www.excelforum.com/member.php...o&userid=24225
View this thread: http://www.excelforum.com/showthread...hreadid=381328


  #3   Report Post  
Dave Peterson
 
Posts: n/a
Default

I agree with what Tom wrote--put those dates in their own cells. It'll make
life much simpler.

But if you can't:

=DATEVALUE(MID(A1,SEARCH(" - ",A1)+3,255))
-DATEVALUE(LEFT(A1,SEARCH(" - ",A1)-1))
(All one cell)

And if your dates are formatted consistently with your windows setting (mdy in
both spots).

dstock wrote:

Suppose cell A2 has 6/27/05 - 7/1/05
A3 has 7/4/05 - 7/8/05... and so
I need to know the formula to coomputer the number of days between
those dates, which is obviously 5. The reason it need to keep the range
in one cell is this will be used in a VLookup function. Thanks!

--
dstock
------------------------------------------------------------------------
dstock's Profile: http://www.excelforum.com/member.php...o&userid=24225
View this thread: http://www.excelforum.com/showthread...hreadid=381328


--

Dave Peterson
Reply
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
Simple question Sheila Clarke Excel Discussion (Misc queries) 2 March 24th 05 04:31 PM
i NEED THE DIFFERENCE OF DATES DOWN TO YEARS...IE 11/1/02-4/16/85. nancelsb Excel Worksheet Functions 1 February 14th 05 02:16 AM
Ploting dates against a calendar and not as a simple events Barb Reinhardt Charts and Charting in Excel 2 January 22nd 05 02:41 AM
How do I calculate difference in days & hours between two dates e. probi2 Excel Worksheet Functions 1 January 12th 05 03:59 PM
Difference between two dates in months with decimals effem Excel Worksheet Functions 3 November 5th 04 05:23 PM


All times are GMT +1. The time now is 04:30 PM.

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

About Us

"It's about Microsoft Excel"