Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8
Default Rounding the result of two times

Hi everyone, I have a problem I can't seem to solve.....Please help.
I have in cell A23 a date and time ---10/19/2008 14:12----
and in cell A24 a date and time----10/20/2008 16:54--- I need this to
calculate the number of hours NOT DAYS and minutes but rond the results to
the nearest half hour........See this is calculating the amount of time that
a product has been out of cold storage so it can't round the time before
calculating.....this is as close as I can come. =TEXT(A24-A23,"[h]:m")
this returns...26:42 and I want it to round to read 26.5
thanks.
--
Mr.B
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,651
Default Rounding the result of two times

On Fri, 28 Nov 2008 19:17:01 -0800, Mr.B wrote:

Hi everyone, I have a problem I can't seem to solve.....Please help.
I have in cell A23 a date and time ---10/19/2008 14:12----
and in cell A24 a date and time----10/20/2008 16:54--- I need this to
calculate the number of hours NOT DAYS and minutes but rond the results to
the nearest half hour........See this is calculating the amount of time that
a product has been out of cold storage so it can't round the time before
calculating.....this is as close as I can come. =TEXT(A24-A23,"[h]:m")
this returns...26:42 and I want it to round to read 26.5
thanks.



26:42 is the time in hours and minutes.

BUT, 26.5 is time in decimal hours -- so if that's what you really want, you
need to do a conversion.

Excel stores dates and times as decimal days, so to convert to hours you
multiply by 24; then round as desired.

For your problem:

=ROUND((A24-A23)*24*2,0)/2

or

=MROUND((A24-A23)*24,0.5)

--------------------

If you would want the result in hours and minutes, to read 26:30, then:

=TEXT(ROUND((A24-A23)/TIME(0,30,0),0)*TIME(0,30,0),"[h]:mm")

or

=TEXT(MROUND(A24-A23,TIME(0,30,0)),"[h]:mm")

Note that you don't need the TEXT function if you can just format the
containing cell.
--ron
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8
Default Rounding the result of two times

Thanks a million I've been working on this for 2 days now and you solved it
for me in 10 minutes .....I can't thank you enough
--
Mr.B


"Ron Rosenfeld" wrote:

On Fri, 28 Nov 2008 19:17:01 -0800, Mr.B wrote:

Hi everyone, I have a problem I can't seem to solve.....Please help.
I have in cell A23 a date and time ---10/19/2008 14:12----
and in cell A24 a date and time----10/20/2008 16:54--- I need this to
calculate the number of hours NOT DAYS and minutes but rond the results to
the nearest half hour........See this is calculating the amount of time that
a product has been out of cold storage so it can't round the time before
calculating.....this is as close as I can come. =TEXT(A24-A23,"[h]:m")
this returns...26:42 and I want it to round to read 26.5
thanks.



26:42 is the time in hours and minutes.

BUT, 26.5 is time in decimal hours -- so if that's what you really want, you
need to do a conversion.

Excel stores dates and times as decimal days, so to convert to hours you
multiply by 24; then round as desired.

For your problem:

=ROUND((A24-A23)*24*2,0)/2

or

=MROUND((A24-A23)*24,0.5)

--------------------

If you would want the result in hours and minutes, to read 26:30, then:

=TEXT(ROUND((A24-A23)/TIME(0,30,0),0)*TIME(0,30,0),"[h]:mm")

or

=TEXT(MROUND(A24-A23,TIME(0,30,0)),"[h]:mm")

Note that you don't need the TEXT function if you can just format the
containing cell.
--ron

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,651
Default Rounding the result of two times

On Fri, 28 Nov 2008 19:56:00 -0800, Mr.B wrote:

Thanks a million I've been working on this for 2 days now and you solved it
for me in 10 minutes .....I can't thank you enough
--
Mr.B


Glad to help. Thanks for the feedback.
--ron
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
ROUNDING RESULT OF CALCULATION UP OR DOWN dartanion Excel Discussion (Misc queries) 15 January 25th 08 02:28 AM
Rounding Error when Calculating similar times Scotty Excel Worksheet Functions 3 November 20th 07 06:56 PM
Rounding times to the nearest 15 minutes in Excel BuckeyeWMV Excel Discussion (Misc queries) 8 April 3rd 07 10:28 PM
Rounding up the result of an IF function donnaK Excel Worksheet Functions 3 December 8th 05 10:15 PM
Rounding up the result cubus Excel Worksheet Functions 13 January 14th 05 08:41 PM


All times are GMT +1. The time now is 09:11 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"