+ Reply to Thread
Results 1 to 3 of 3

Excel 2007 : working with Day and Time and calculating

  1. #1
    Registered User
    Join Date
    05-09-2010
    Location
    Austin, Texas
    MS-Off Ver
    Excel 2003
    Posts
    2

    working with Day and Time and calculating

    I need help with formula to calculate time only if the event occurs on certain days (Monday through Friday) and only if between 1:00PM and 7:00PM. Currently I have to go through all the data and do this manually and hope someone can help automated this process. I have attached a sample file with data dowloaded from loggers. The "On-Peak Hours" is the column I need to automate, everything else is calculating properly.

    I use lighting loggers to record when lights come on/off so here's what I am hoping to do: If the event is recorded between 1:00PM to 7:00PM, Monday - Friday, I want subtract the ON time from the OFF time (Status Column). If it happens any other time, return 0. Often the lights will come on after 1:00PM, but not go off until after 7:00, but I must limit the total to 7:00PM.

    I know there is a number of things to consider, but can this be done? Any help is greatly appreciated.

    Thanks,
    Attached Files Attached Files

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: working with Day and Time and calculating

    Try this in D22

    =IF(WEEKDAY(A21,2)<6,IF((AND(HOUR(A21)>13,HOUR(A22)<19)),A22-A21),"")
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    05-09-2010
    Location
    Austin, Texas
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: working with Day and Time and calculating

    Thank you RoyUK! That is very close!! On the days when it logs past 7:00PM, is it possible to only calculate the time up to 7 and exclude the remaining?

    I really appreciate the help!!

    Keith

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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