+ Reply to Thread
Results 1 to 6 of 6

Excel 2007 : Cell to display "Night Worker" or "Day Worker" from Date Time

  1. #1
    Registered User
    Join Date
    07-26-2010
    Location
    Wilmington, DE
    MS-Off Ver
    Excel 2007
    Posts
    3

    Cell to display "Night Worker" or "Day Worker" from Date Time

    I have a spreadsheet with 1,000 records of data that has 10 columns, one being (Time Started) with date and time (2/15/2010 9:34:31 AM).

    I want to display in another new column (Processors) “Day workers” or “Night Workers” from the spreadsheet’s (2/15/2010 9:34:31 AM) data. I would desire 7am to 3:30pm “Day Workers” and all else “Night Workers”.

    I attempted to use the formula “IF(AND(HOUR(NOW())>=7,HOUR(NOW())<=16),"Day Workers","Night Workers")” in a post recorded already, but it will only displays “Day Workers”. I am attaching my spreadsheet for clarification.
    Attached Files Attached Files
    Last edited by jwmacob; 08-03-2010 at 11:44 AM. Reason: Problem Solved

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

    Re: Cell to display "Night Worker" or "Day Worker" from Date Time

    In M2:

    =IF(AND(HOUR(K2)>=7,HOUR(K2)<=16),"Day Workers","Night Workers")
    _________________
    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!)

  3. #3
    Registered User
    Join Date
    07-26-2010
    Location
    Wilmington, DE
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Cell to display "Night Worker" or "Day Worker" from Date Time

    Quote Originally Posted by JBeaucaire View Post
    In M2:

    =IF(AND(HOUR(K2)>=7,HOUR(K2)<=16),"Day Workers","Night Workers")

    I must be doing something wrong as I paste the formula to the cell, because I am still coming up with all "Day Workers". Do I just paste the formula or do I apply another approach to input the formula? I know it is something I am missing now.

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Cell to display "Night Worker" or "Day Worker" from Date Time

    The formula would return different answers pending time, check you're running XL in Auto Calculation mode (ie pressing F9 does not alter the results).

    Quote Originally Posted by jwmjacob
    I would desire 7am to 3:30pm “Day Workers” and all else “Night Workers”.
    In which case I would suggest:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    07-26-2010
    Location
    Wilmington, DE
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Cell to display "Night Worker" or "Day Worker" from Date Time

    Quote Originally Posted by DonkeyOte View Post
    The formula would return different answers pending time, check you're running XL in Auto Calculation mode (ie pressing F9 does not alter the results).



    In which case I would suggest:

    Please Login or Register  to view this content.

    Thanks... JBeaucaire and DonkeyOte the formula works just fine... It was something I was doing wrong.

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

    Re: Cell to display "Night Worker" or "Day Worker" from Date Time

    If that takes care of your need, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED .

+ 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