![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Join Date: Dec 2005
Location: Seattle, WA
Posts: 321
|
Dear World’s Smartest Excel Team,
I have this formula for rounding up to the five minute mark: =CEILING(A2,0.00347222222222224) Where A2 has a time. Question 1: Is my use of the decimal the best way to do this (best means accurate result and/or shortest formula)? Also, what formula could I use to apply the standard rounding rule (select digit you want to round to, if the digit to the right it is 5 or more add 1, if the digit to the right it is less than 5 leave as is; standard ROUND function rule) so that I could round to the 5 minute mark? For example: 2:02:30 PM would become 2:05:00 PM 2:02:29 PM would become 2:00:00 PM Any ideas?
__________________
Sincerely, Mike Gel Girvin |
|
|
|
|
|
#2 |
|
Join Date: Sep 2004
Location: Hampshire, England
Posts: 4,023
|
Hello
Q1: =CEILING(A2,"00:05") Q2: =ROUND(B1/"00:05",0)*"00:05"
__________________
Regards Jon (XP Pro v.2002, XL2003)
|
|
|
|
|
|
#3 |
|
Join Date: Jan 2009
Location: Muscatine, Iowa, USA
Posts: 33
|
Hey,
Keep in mind there is also ROUNDDOWN and ROUNDUP for those more specific instances. |
|
|
|
|
|
#4 |
|
Join Date: Dec 2005
Location: Seattle, WA
Posts: 321
|
Dear Jon von der Heyden,
That is so clever. I can hardy believe it: 1) Ask how many 5 minute chunks there are, 2) Round to the integer, 3) Then multiply by five minutes!! Did you make that up, or did you see it somewhere? Thanks a lot, Jon von der Heyden!
__________________
Sincerely, Mike Gel Girvin |
|
|
|
|
|
#5 |
|
Join Date: Sep 2004
Location: Hampshire, England
Posts: 4,023
|
I think I first saw this in a post by Barry Houdini. This question appears quite frequently, only usually to round to nearest 0.5.
You're welcome!
__________________
Regards Jon (XP Pro v.2002, XL2003)
|
|
|
|
|
|
#6 |
|
Join Date: Dec 2005
Location: Seattle, WA
Posts: 321
|
It all starts with Aladin and Houdini, I guess.
We are lucky to be part of an amazing Excel Team!!! Thanks again!
__________________
Sincerely, Mike Gel Girvin |
|
|
|
|
|
#7 |
|
MrExcel MVP
Join Date: Mar 2005
Location: England
Posts: 14,298
|
|
|
|
|
|
|
#8 |
|
Join Date: Dec 2005
Location: Seattle, WA
Posts: 321
|
Dear Houdini,
Another great trick! I like MROUND becasue it completes the group: CEILING, FLOOR, MROUND. Just as ROUNDUP, ROUNDDOWN, ROUND are a group. Thanks for helping to Lead the Team, Houdini!
__________________
Sincerely, Mike Gel Girvin |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|