+ Reply to Thread
Results 1 to 5 of 5

Excel 2007 : Calculating and Rounding Time to Nearest 15 min Interval

  1. #1
    Registered User
    Join Date
    01-25-2010
    Location
    Macon, GA
    MS-Off Ver
    Excel 2007
    Posts
    1

    Calculating and Rounding Time to Nearest 15 min Interval

    After finally getting my spreadsheet to do exactly what I want it to do, the payroll department made a change...grrr.

    Now the goal is to automatically round the time to the nearest 15 minute increment within the same cell. I also want to total these times at the end of the row to show hours and minutes instead of converted to decimals. I already have code to enter a time in one cell and it automatically insert the colon without having to type it. Another drawback, we have some shifts that work past midnight. This is overcome by entering the date and the time, and I don't have any problems with that...yet.

    My current VBA:

    Please Login or Register  to view this content.
    And the current formula for calculating the row of times:

    =+((C5-B5+E5-D5+G5-F5+I5-H5)*1)*24

    Example of what I would enter on the spreadsheet:

    B5=0550 C5=1536 D5=1605 E5=1805 J5=11.77 (Total converted to decimal)

    What I want each cell to look like:

    B5=05:45 C5=15:30 D5=16:00 E5=18:00 J5=12.30

    Sorry if this is confusing, but I have racked my brain for the past week. Let me know if you'd like to see the actual spreadsheet.

    Thanks
    Attached Files Attached Files
    Last edited by SherylH; 01-28-2010 at 11:47 AM. Reason: Non-compliance

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Calculating and Rounding Time to Nearest 15 min Interval

    Welcome to the forum,

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Calculating and Rounding Time to Nearest 15 min Interval

    Would this be easier with an uploaded sample excerpt from your real workbook? It would be easier for you to show us there, wouldn't it?

    Click GO ADVANCED and use the paperclip icon to post up your workbook.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Calculating and Rounding Time to Nearest 15 min Interval

    Your post does not comply with Rule 8 of our Forum RULES. Cross-posting is when you post the same question in other forums on the web. You'll find people are disinclined to respond to cross-posts because they may be wasting their time solving a problem that has been solved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser)to the cross-post. Expect cross-posts without a link to be closed a message will be posted by the moderator explaining why. We are here to help so help us help you!

    http://www.thecodecage.com/forumz/me...-interval.html

  5. #5
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Calculating and Rounding Time to Nearest 15 min Interval

    There is a responce to the other cross-post
    http://www.mrexcel.com/forum/showthread.php?t=443704
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1