+ Reply to Thread
Results 1 to 11 of 11

Time Calculation help needed

  1. #1
    Registered User
    Join Date
    11-13-2012
    Location
    TX
    MS-Off Ver
    Excel 2007
    Posts
    9

    Time Calculation help needed

    Hello,

    I am trying to help my boss out by making our Excel spreadsheet schedule work smarter. Unfortunately, I have to work within a standard schedule provided by the company, so I am hoping someone can help me out, even if it's only with pieces of my request.

    Background:
    This is for scheduled hours, not actual worked hours (otherwise, this would be easier for me). I have start and end time columns for each person. I have it calculating daily and then weekly hours. However, some days will have text instead of times if they have the day off. The schedule does not account for lunch breaks, so I have that built into the daily hour calculation formulas.

    Help needed:
    I need the daily calculations to put out a zero if the field includes text or if it is left blank. If it helps, the text will state either "off" or "vacation." Blanks are problematic since I had to build the lunch hour into the calculation formula; they are creating negative hours worked.)
    ***For example, I need it to say C3-B3=X hours unless B3="off" "vacation" or is left blank, then C3-B3=0

    Bonus question:
    Can time cells be formatted to display without the am/pm but also without using 24-hour format? The times will be typed directly into the field, not into a formula, so it really needs to be done with cell formatting.

    Thanks so much in advance!
    Gina

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,957

    Re: Time Calculation help needed

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Registered User
    Join Date
    11-13-2012
    Location
    TX
    MS-Off Ver
    Excel 2007
    Posts
    9
    We've lost power due to the storm. I will mock it up and submit as soon as I can. Thanks!

  4. #4
    Registered User
    Join Date
    11-13-2012
    Location
    TX
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Time Calculation help needed

    I have attached the mocked up sample with the current formats and formulas as well as what I need it to look like. Thanks!
    Attached Files Attached Files

  5. #5
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,957

    Re: Time Calculation help needed

    Explain to me a bit more on how the lunch hour is calculated. I see that on Saturday, the lunch hour seems not to be taken out of the calculation. On the other hand time worked Mon-Fri does have a lunch hour taken out. So this seems to indicate that if the start and end times span the lunch hour, then an hour is deducted. What is this time span?

  6. #6
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,957

    Re: Time Calculation help needed

    Due to a site malfunction I might have to post the actual workbook in a separate reply.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    11-13-2012
    Location
    TX
    MS-Off Ver
    Excel 2007
    Posts
    9
    Quote Originally Posted by dflak View Post
    Explain to me a bit more on how the lunch hour is calculated. I see that on Saturday, the lunch hour seems not to be taken out of the calculation. On the other hand time worked Mon-Fri does have a lunch hour taken out. So this seems to indicate that if the start and end times span the lunch hour, then an hour is deducted. What is this time span?
    Saturdays do not have a lunch because we close at noon, so it was taken out of the formula for that day.
    Mon-Fri, lunch is either half or full hour, depending on how many hours the employee is scheduled for. It typically doesn't vary within one person's schedule, so as long as I have the lunch hour subtracted correctly for each person, it should calculate hours correctly.
    I will take a look at your attachments when I get home from work this afternoon.

  8. #8
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,957

    Re: Time Calculation help needed

    I might have to undo my hairy formula then . What are the rules? How many hours does a person have to work to get 0 hours, 0.5 hours and 1 hour?

  9. #9
    Registered User
    Join Date
    11-13-2012
    Location
    TX
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Time Calculation help needed

    For lunch, less than 5 hours scheduled is no lunch, 6 hours or more is an hour, and anything in between is half an hour.

    To answer your question in the Word doc about the Bonus question since you don't see a difference...
    I'd like to know if there is a way to format the cells so that it displays the time without displaying the am/pm but also not displaying in 24 hour time.
    For example, if the cell currently says "6:15 PM", can the cell be formatted to display it as "6:15"? Obviously, when typing the time in, it'd still need to be entered as "6:15 PM" for the calculations to work correctly.
    If not, that's fine, but that's why I called it a bonus. I would like to keep the readability simple, and not change it too much from what people are used to seeing on the schedule currently.

  10. #10
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,957

    Re: Time Calculation help needed

    I dropped the complicated formula and substituted one based on hours. It used VLOOKUP with the TRUE option. On sheet 3 there is a small table. The range(A2:B4) is given the name Lunch_Time. If the number of hours is less than 5, the VLOOKUP returns 0. If it is 6 or more, it returns 1. Anything in between returns 0.5.

    I don't think I can do the bonus straightaway. The closest we can come is 24-hour time. E.g. 8:30 to 16:30. Otherwise, it's ambiguous if you mean 7 AM or 7 PM. I could do some "windowing" meaning if it sees a time less than 7:00, it will add a half a day. So 8:30 to 4:30 would be interpreted by the formula to be 8:30 to 16:30. The problem here is that if someone works past 7 PM, you will have to enter the time as either 19:00 or 7 PM and not 7:00. Would this be acceptable?
    Attached Files Attached Files
    Last edited by dflak; 03-16-2017 at 09:33 AM. Reason: Add attachment

  11. #11
    Registered User
    Join Date
    11-13-2012
    Location
    TX
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Time Calculation help needed

    Thank you so much for your help. I can make this work.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Calculation help needed
    By twmills in forum Excel General
    Replies: 6
    Last Post: 03-04-2016, 10:21 AM
  2. Help needed: SLA & Turnaround Time Calculation
    By whiteappletree in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-18-2015, 05:38 AM
  3. Macro needed for time calculation and auto insert
    By ballst in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-15-2015, 04:28 AM
  4. Calculation in a Rota - Help Needed Please
    By NMGIBBS in forum Excel General
    Replies: 5
    Last Post: 01-06-2015, 06:47 AM
  5. Time calculation help needed
    By frustrated in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-05-2013, 07:16 PM
  6. Time Sheet Calculation Help Needed!
    By sax30 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-26-2005, 04:06 PM

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