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 results of two times

I recently asked how to round a date and time and I got what I was looking
for but I think there may be a flaw in my formula or excel.....
A1 12/5/2008 8:00
A2 12/5/2008 15:45
using the formula
=round((A2-A1)*24*2,0)/2

gives me a result of 7.5 and it should be 8.0 so it is not rounding to he
half hour correctly ..........using the same if I change A1 to 7:00 it shows
9.0 hours and is correct.........so why is the 8 oclock hour rounding
differently......can I fix this...?

--
Mr.B
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4,393
Default rounding the results of two times

The formula works for me giving 7.5. Try formatting the cell to show more
decimals - you could use the Increase Decimals tool

If I want to see 7:30 I need =round((A2-A1)*24*2,0)/(2*24) and format the
cell as Time

best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"Mr.B" wrote in message
...
I recently asked how to round a date and time and I got what I was looking
for but I think there may be a flaw in my formula or excel.....
A1 12/5/2008 8:00
A2 12/5/2008 15:45
using the formula
=round((A2-A1)*24*2,0)/2

gives me a result of 7.5 and it should be 8.0 so it is not rounding to he
half hour correctly ..........using the same if I change A1 to 7:00 it
shows
9.0 hours and is correct.........so why is the 8 oclock hour rounding
differently......can I fix this...?

--
Mr.B



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8
Default rounding the results of two times

The format is right I need this to figure out the amount of time a product
has been out of cold storage
but 8 til 1545 is 7 hours and 45 minutes this should be rounded to the next
full hour showing 8.0 as the result
using the same format try adding another hour on and then it will round to
the next whole hour
this is confusing me
--
Mr.B


"Bernard Liengme" wrote:

The formula works for me giving 7.5. Try formatting the cell to show more
decimals - you could use the Increase Decimals tool

If I want to see 7:30 I need =round((A2-A1)*24*2,0)/(2*24) and format the
cell as Time

best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"Mr.B" wrote in message
...
I recently asked how to round a date and time and I got what I was looking
for but I think there may be a flaw in my formula or excel.....
A1 12/5/2008 8:00
A2 12/5/2008 15:45
using the formula
=round((A2-A1)*24*2,0)/2

gives me a result of 7.5 and it should be 8.0 so it is not rounding to he
half hour correctly ..........using the same if I change A1 to 7:00 it
shows
9.0 hours and is correct.........so why is the 8 oclock hour rounding
differently......can I fix this...?

--
Mr.B




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

If you want always to round UP, you'd be better off using CELING. If you
want to know why it isn't rounding up when you think you are exactly on the
quarter hour, look at what =(A2-A1)*24 shows when formatted to 15 or so
decimal places.
If you don't understand why it's doing that, work out what the *exact*
binary representation of 8/24 would be, and let us know the answer. :-)
--
David Biddulph


"Mr.B" wrote in message
...
The format is right I need this to figure out the amount of time a product
has been out of cold storage
but 8 til 1545 is 7 hours and 45 minutes this should be rounded to the
next
full hour showing 8.0 as the result
using the same format try adding another hour on and then it will round to
the next whole hour
this is confusing me
--
Mr.B


"Bernard Liengme" wrote:

The formula works for me giving 7.5. Try formatting the cell to show more
decimals - you could use the Increase Decimals tool

If I want to see 7:30 I need =round((A2-A1)*24*2,0)/(2*24) and format the
cell as Time

best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"Mr.B" wrote in message
...
I recently asked how to round a date and time and I got what I was
looking
for but I think there may be a flaw in my formula or excel.....
A1 12/5/2008 8:00
A2 12/5/2008 15:45
using the formula
=round((A2-A1)*24*2,0)/2

gives me a result of 7.5 and it should be 8.0 so it is not rounding to
he
half hour correctly ..........using the same if I change A1 to 7:00 it
shows
9.0 hours and is correct.........so why is the 8 oclock hour rounding
differently......can I fix this...?

--
Mr.B






  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,722
Default rounding the results of two times

You should be able to just add another ROUND
=ROUND(ROUND((A2-A1)*24*2,0)/2,0)
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Mr.B" wrote:

The format is right I need this to figure out the amount of time a product
has been out of cold storage
but 8 til 1545 is 7 hours and 45 minutes this should be rounded to the next
full hour showing 8.0 as the result
using the same format try adding another hour on and then it will round to
the next whole hour
this is confusing me
--
Mr.B


"Bernard Liengme" wrote:

The formula works for me giving 7.5. Try formatting the cell to show more
decimals - you could use the Increase Decimals tool

If I want to see 7:30 I need =round((A2-A1)*24*2,0)/(2*24) and format the
cell as Time

best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"Mr.B" wrote in message
...
I recently asked how to round a date and time and I got what I was looking
for but I think there may be a flaw in my formula or excel.....
A1 12/5/2008 8:00
A2 12/5/2008 15:45
using the formula
=round((A2-A1)*24*2,0)/2

gives me a result of 7.5 and it should be 8.0 so it is not rounding to he
half hour correctly ..........using the same if I change A1 to 7:00 it
shows
9.0 hours and is correct.........so why is the 8 oclock hour rounding
differently......can I fix this...?

--
Mr.B






  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8
Default rounding the results of two times

I'm not sure what you mean with the binary representation, but try this and
see what you guys think.
A1 12/10/2008 8:00
A2 12/10/2008 11:45

using the formula
=ROUND((A2-A1)*24*2,0)/2
returns a result of 4.0 ................this is correct........I want to
round to the nearest half hour, if I shorten A2 by 1 hour to read 10:45 the
result is 2.5 (not correct)
remember that I cant round the time before the results because I need to
know how long this has been out. so the result of how much time is used
should round like this
00-14 minutes rounds down to the whole hour
15-29 minutes rounds up to the half hour
30-44 minutes rounds down to the half hour
45-59 minutes rounds up to the whole hour

I'm still confused why it does this.
thanks for any and all help.

--
Mr.B


"David Biddulph" wrote:

If you want always to round UP, you'd be better off using CELING. If you
want to know why it isn't rounding up when you think you are exactly on the
quarter hour, look at what =(A2-A1)*24 shows when formatted to 15 or so
decimal places.
If you don't understand why it's doing that, work out what the *exact*
binary representation of 8/24 would be, and let us know the answer. :-)
--
David Biddulph


"Mr.B" wrote in message
...
The format is right I need this to figure out the amount of time a product
has been out of cold storage
but 8 til 1545 is 7 hours and 45 minutes this should be rounded to the
next
full hour showing 8.0 as the result
using the same format try adding another hour on and then it will round to
the next whole hour
this is confusing me
--
Mr.B


"Bernard Liengme" wrote:

The formula works for me giving 7.5. Try formatting the cell to show more
decimals - you could use the Increase Decimals tool

If I want to see 7:30 I need =round((A2-A1)*24*2,0)/(2*24) and format the
cell as Time

best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"Mr.B" wrote in message
...
I recently asked how to round a date and time and I got what I was
looking
for but I think there may be a flaw in my formula or excel.....
A1 12/5/2008 8:00
A2 12/5/2008 15:45
using the formula
=round((A2-A1)*24*2,0)/2

gives me a result of 7.5 and it should be 8.0 so it is not rounding to
he
half hour correctly ..........using the same if I change A1 to 7:00 it
shows
9.0 hours and is correct.........so why is the 8 oclock hour rounding
differently......can I fix this...?

--
Mr.B






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 the result of two times Mr.B Excel Worksheet Functions 3 November 29th 08 05:12 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 results by ranges mmarley50 Excel Worksheet Functions 3 November 2nd 06 08:45 PM
Rounding results to nearest quarter (in decimals) djarcadian Excel Discussion (Misc queries) 5 October 27th 05 12:35 AM


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