Web Design Forums

General Discussion

If you want to talk about anything other than web design? This is the place for you.

rounding time values in excel



Site of the Month Nominations
ENTER YOUR SITE NOW!

Reply
 
LinkBack Thread Tools
Old May 9 '04, 01:17 AM (#1)
skrlin is offline
JavaScript Enthusiast
 
skrlin's Avatar
 
Join Date: April 2003
Location: Illinois
Posts: 562
skrlin has disabled reputation
Send a message via AIM to skrlin
rounding time values in excel

What I'm looking to do is create a spreadsheet that will calculate a paycheck based on the times inputed on the days worked. Here's the catch: I want excel to round the minutes up or down to 15 min increments. It would round up 7 minutes and 30 seconds after each increment but I don't want to be that technical, instead it would round at 7 whole minutes
Explanation:
7:01 - 7:07 would get rounded down to 7:00
7:08 - 7:14 would get rounded up to 7:15
7:16 - 7:22 would get rounded down to 7:15
7:23 - 7:29 would get rounded up to 7:30
...and so on.

I can't figure out how to use the functions to round minutes out of the time format without splitting the time into hours and minutes in different cells, which I don't want to do. Any ideas ?

I'm open to suggestions for other ways of doing this in PHP/MySQL, JavaScript (however sloppily). Any ideas ??
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old May 9 '04, 01:35 AM (#2)
TheGAME1264 is offline
Mod-son Canadian
 
TheGAME1264's Avatar
 
Join Date: December 2002
Location: Toronto, Ontario
Posts: 3,032
TheGAME1264 has disabled reputation
From Excel directly, you could enter in a series of nested if statements. It's messy as all hell, but it will work.

Something like this:
Code:
=IF(MINUTE(A1)>7,IF(MINUTE(A1)>22,IF(MINUTE(A1)>37,IF(MINUTE(A1)>52,0,45),30),15),0)
That will create your minute value based on your interval. I'll leave it to you to tweak the rest to come up with the appropriate hour value (since there is a case after 52 where it differs, and I'm too tired to think of it.)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old May 9 '04, 01:37 AM (#3)
skrlin is offline
JavaScript Enthusiast
 
skrlin's Avatar
 
Join Date: April 2003
Location: Illinois
Posts: 562
skrlin has disabled reputation
Send a message via AIM to skrlin
Hmmm... I'll have a go at that tomorrow. Thanks for the quick reply.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old May 9 '04, 01:52 AM (#4)
TheGAME1264 is offline
Mod-son Canadian
 
TheGAME1264's Avatar
 
Join Date: December 2002
Location: Toronto, Ontario
Posts: 3,032
TheGAME1264 has disabled reputation
You got it, buddy. Let me know how that works out.

(By the way, that formula is correct. I checked it in Excel and C&Ped it.)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old May 9 '04, 03:59 PM (#5)
benbun is offline
WDF Member
 
benbun's Avatar
 
Join Date: March 2004
Posts: 51
benbun has disabled reputation
Send a message via MSN to benbun
Ok assuming your time (to be rounded is in A1), you could use the following.

=IF(MOD(A1,(1/96))<(1/192),A1-MOD(A1,(1/96)),A1-MOD(A1,(1/96))+(1/96))

if you want I can forward an example spreadsheet showing this in action.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old May 9 '04, 05:02 PM (#6)
TheGAME1264 is offline
Mod-son Canadian
 
TheGAME1264's Avatar
 
Join Date: December 2002
Location: Toronto, Ontario
Posts: 3,032
TheGAME1264 has disabled reputation
benbun: could you upload it please? I'd like to see the example and understand the formula myself. I'm assuming MOD is the same as it is in VBScript (a remainder), but why you have numbers in fractions is semi-confusing to me.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old May 10 '04, 06:40 AM (#7)
benbun is offline
WDF Member
 
benbun's Avatar
 
Join Date: March 2004
Posts: 51
benbun has disabled reputation
Send a message via MSN to benbun
I will upload the file once I get home as it is on my home PC.

To understand the fractions you need to understand how Excel deals with times.

Excel splits the day into seconds.
Therefore one day has 24 * 60 * 60 = 86,400 seconds ( Hours x minutes x seconds ).

Therefore 1/86400 = 1 second.

Using this we can say 15 minutes = 15 x 60 = 900 seconds. To denote this in Excel we use 900 x 1/86400 = 900/86400.

This simplifies to 1/96 and hence the mysterious fraction used in the formula.

Hope this helps

Last edited by benbun; May 10 '04 at 10:59 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old May 10 '04, 09:48 AM (#8)
TheGAME1264 is offline
Mod-son Canadian
 
TheGAME1264's Avatar
 
Join Date: December 2002
Location: Toronto, Ontario
Posts: 3,032
TheGAME1264 has disabled reputation
Ahhhhh yes. Makes sense now. I don't often use Excel; hence the question.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old May 10 '04, 10:51 PM (#9)
skrlin is offline
JavaScript Enthusiast
 
skrlin's Avatar
 
Join Date: April 2003
Location: Illinois
Posts: 562
skrlin has disabled reputation
Send a message via AIM to skrlin
Well, I tried your formula a couple of different ways Adam, but to avail...but when I tried benbun's I just changed the cell number and it worked like a charm. And he even helped me to figure out my next question (about calculating overtime) with his next post. So I awarded benbun the TD. I appreciate the effort though. Thanks guys!

Last edited by skrlin; May 10 '04 at 10:52 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old May 10 '04, 11:30 PM (#10)
TheGAME1264 is offline
Mod-son Canadian
 
TheGAME1264's Avatar
 
Join Date: December 2002
Location: Toronto, Ontario
Posts: 3,032
TheGAME1264 has disabled reputation
No harm, bro. I liked his way better than mine anyway. To get mine to work would have required some extra effort and been way more complex a formula anyway. Besides, I learned something.

benbun earned them, as far as I'm concerned.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old May 12 '04, 12:44 AM (#11)
skrlin is offline
JavaScript Enthusiast
 
skrlin's Avatar
 
Join Date: April 2003
Location: Illinois
Posts: 562
skrlin has disabled reputation
Send a message via AIM to skrlin
Ditto. I learned a bit from it too. So you guys can see what I was working on and maybe improve on it, I'll upload the finished product and a sample to show how it works.
Attached Files
File Type: zip time-template.zip (11.1 KB, 10 views)

Last edited by skrlin; May 12 '04 at 12:57 AM. Reason: made a change to .zip
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old May 12 '04, 12:44 AM (#12)
skrlin is offline
JavaScript Enthusiast
 
skrlin's Avatar
 
Join Date: April 2003
Location: Illinois
Posts: 562
skrlin has disabled reputation
Send a message via AIM to skrlin
BTW, thanks again for the help fellas.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

  Web Design Forums » Other Forums » General Discussion

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


 
User Infomation
Your Avatar

Site Of The Month

Ticket Cake
Ticket Cake

Ticket Cake is a drupal based event ticketing platform. It features that ability to browse events and share them.

Nominate Your Site Now!

Advertisement
WolfCMS.org

Latest Articles
- by RickM
- by bfsog

Advertisement

Partner Links



All times are GMT -4. The time now is 02:30 AM.


WebDesignForums.net is Copyright © 2010 RikeMedia.

SEO by vBSEO

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163