Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
MWH
 
Posts: n/a
Default Date Calc in hours

I'm trying to perform a date calc to produce a variance in hours
ex cell A1 3/27/2006 2100, cell B1 3/28/2006 0100, cell C1 =b1-a1, results I
would like to see is 4
This spreadsheet will be used for scheduling so both positive and negative
numbers will be used for variance numbers.


--
Mark W. Hanford



  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ryan Poth
 
Posts: n/a
Default Date Calc in hours

Mark,
Depending on whether you want to round or truncate to the number of whole
hours, use one of the following in cell C1:

=ROUND((A2-A1)*24,0)
or
=INT((A2-A1)*24)

HTH,
Ryan

"MWH" wrote:

I'm trying to perform a date calc to produce a variance in hours
ex cell A1 3/27/2006 2100, cell B1 3/28/2006 0100, cell C1 =b1-a1, results I
would like to see is 4
This spreadsheet will be used for scheduling so both positive and negative
numbers will be used for variance numbers.


--
Mark W. Hanford




  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Peo Sjoblom
 
Posts: n/a
Default Date Calc in hours

I think you missed that he is not using excel time (hh:mm) he is using 2100
and 0100

--

Regards,

Peo Sjoblom

Northwest Excel Solutions

www.nwexcelsolutions.com

(remove ^^ from email address)

Portland, Oregon




"Ryan Poth" wrote in message
...
Mark,
Depending on whether you want to round or truncate to the number of whole
hours, use one of the following in cell C1:

=ROUND((A2-A1)*24,0)
or
=INT((A2-A1)*24)

HTH,
Ryan

"MWH" wrote:

I'm trying to perform a date calc to produce a variance in hours
ex cell A1 3/27/2006 2100, cell B1 3/28/2006 0100, cell C1 =b1-a1,
results I
would like to see is 4
This spreadsheet will be used for scheduling so both positive and
negative
numbers will be used for variance numbers.


--
Mark W. Hanford





  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
MWH
 
Posts: n/a
Default Date Calc in hours

Still get an error message
"Ryan Poth" wrote in message
...
Mark,
Depending on whether you want to round or truncate to the number of whole
hours, use one of the following in cell C1:

=ROUND((A2-A1)*24,0)
or
=INT((A2-A1)*24)

HTH,
Ryan

"MWH" wrote:

I'm trying to perform a date calc to produce a variance in hours
ex cell A1 3/27/2006 2100, cell B1 3/28/2006 0100, cell C1 =b1-a1,
results I
would like to see is 4
This spreadsheet will be used for scheduling so both positive and
negative
numbers will be used for variance numbers.


--
Mark W. Hanford






  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Peo Sjoblom
 
Posts: n/a
Default Date Calc in hours

Use excel time format and just subtract, if this is some sort of import and
there are never more than 24 hours difference you can use

=MOD(TEXT(MID(B1,FIND(" ",B1)+1,255),"00\:00")-TEXT(MID(A1,FIND("
",A1)+1,255),"00\:00"),1)

if more than 24 hours you would need to use the dates as well, more ugly
looking

=(LEFT(B1,FIND(" ",B1)-1)+TEXT(MID(B1,FIND("
",B1)+1,255),"00\:00"))-(LEFT(A1,FIND(" ",A1)-1)+TEXT(MID(A1,FIND("
",A1)+1,255),"00\:00"))

format as time will return 4:00

--

Regards,

Peo Sjoblom

Northwest Excel Solutions

www.nwexcelsolutions.com

(remove ^^ from email address)

Portland, Oregon




"MWH" wrote in message
...
I'm trying to perform a date calc to produce a variance in hours
ex cell A1 3/27/2006 2100, cell B1 3/28/2006 0100, cell C1 =b1-a1, results
I would like to see is 4
This spreadsheet will be used for scheduling so both positive and negative
numbers will be used for variance numbers.


--
Mark W. Hanford





  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
MWH
 
Posts: n/a
Default Date Calc in hours

Works good except both will not return a value over 24, sometimes variance I
will have will be greater than 24 hrs, also variances may be a negative
number




"Peo Sjoblom" wrote in message
...
Use excel time format and just subtract, if this is some sort of import
and there are never more than 24 hours difference you can use

=MOD(TEXT(MID(B1,FIND(" ",B1)+1,255),"00\:00")-TEXT(MID(A1,FIND("
",A1)+1,255),"00\:00"),1)

if more than 24 hours you would need to use the dates as well, more ugly
looking

=(LEFT(B1,FIND(" ",B1)-1)+TEXT(MID(B1,FIND("
",B1)+1,255),"00\:00"))-(LEFT(A1,FIND(" ",A1)-1)+TEXT(MID(A1,FIND("
",A1)+1,255),"00\:00"))

format as time will return 4:00

--

Regards,

Peo Sjoblom

Northwest Excel Solutions

www.nwexcelsolutions.com

(remove ^^ from email address)

Portland, Oregon




"MWH" wrote in message
...
I'm trying to perform a date calc to produce a variance in hours
ex cell A1 3/27/2006 2100, cell B1 3/28/2006 0100, cell C1 =b1-a1,
results I would like to see is 4
This spreadsheet will be used for scheduling so both positive and
negative numbers will be used for variance numbers.


--
Mark W. Hanford





  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Peo Sjoblom
 
Posts: n/a
Default Date Calc in hours

The second will return a value over 24 hours, just use [hh]:mm as format,
for example if you change the date to
3/29/06 0100 the second will return 28:00, it won't work with negative times
unless you change the date format to 1904 or use decimal hours
--

Regards,

Peo Sjoblom

Northwest Excel Solutions

www.nwexcelsolutions.com

(remove ^^ from email address)

Portland, Oregon




"MWH" wrote in message
...
Works good except both will not return a value over 24, sometimes variance
I will have will be greater than 24 hrs, also variances may be a negative
number




"Peo Sjoblom" wrote in message
...
Use excel time format and just subtract, if this is some sort of import
and there are never more than 24 hours difference you can use

=MOD(TEXT(MID(B1,FIND(" ",B1)+1,255),"00\:00")-TEXT(MID(A1,FIND("
",A1)+1,255),"00\:00"),1)

if more than 24 hours you would need to use the dates as well, more ugly
looking

=(LEFT(B1,FIND(" ",B1)-1)+TEXT(MID(B1,FIND("
",B1)+1,255),"00\:00"))-(LEFT(A1,FIND(" ",A1)-1)+TEXT(MID(A1,FIND("
",A1)+1,255),"00\:00"))

format as time will return 4:00

--

Regards,

Peo Sjoblom

Northwest Excel Solutions

www.nwexcelsolutions.com

(remove ^^ from email address)

Portland, Oregon




"MWH" wrote in message
...
I'm trying to perform a date calc to produce a variance in hours
ex cell A1 3/27/2006 2100, cell B1 3/28/2006 0100, cell C1 =b1-a1,
results I would like to see is 4
This spreadsheet will be used for scheduling so both positive and
negative numbers will be used for variance numbers.


--
Mark W. Hanford






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
Adding hours to a date Rich Excel Worksheet Functions 6 November 28th 06 08:50 PM
Hours and minutes display as date in formula box Dave Excel Discussion (Misc queries) 13 July 28th 06 07:47 PM
rounddown with date calc? Ltat42a Excel Discussion (Misc queries) 5 January 5th 06 08:04 PM
Calc End Date OCD Cindy Excel Worksheet Functions 2 September 18th 05 09:52 PM
How do I calculate if a date is in a certain time frame? Pe66les Excel Worksheet Functions 19 August 27th 05 11:07 PM


All times are GMT +1. The time now is 10:06 AM.

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"