+ Reply to Thread
Results 1 to 6 of 6

How to reference Timevalue to change a cell's text to another text

  1. #1
    Registered User
    Join Date
    11-16-2014
    Location
    North America
    MS-Off Ver
    2013
    Posts
    8

    How to reference Timevalue to change a cell's text to another text

    I have a spreadsheet that is being used for an end of shift report between day shift and night shift. This spread sheet is being tied into an automated system to log facility data before being emailed out at the end of each shift automatically.

    I may be over thinking this so I really hope someone can school me here, but what I need is for one single cell to automatically change from Days or Nights depending on the time range. That being said I will list what I have below.

    I3 is where the "Days" or "Nights" text string needs to be stored and its currently setup as a drop down hence the reason I am looking to automate this.

    Before adding the drop down I tried using the following formula =IF(D3>=O2,D3<=P2,"Days")*IF(D3>=O3,D3<=P3,"Nights") and the cell just = 0. I would really like to create this without having to reference static time values listed below and just use the timevalue and set up a limit, but I am not sure how this can be done.

    The values for each cell are as follows:
    D3 = NOW() in 24 hour
    O2 = Day shift start time (7:00)
    P2 = Day shift end time (17:30)
    O3 = Night shift start time (19:00)
    P3 = Night shift start time (5:30)

    Thank you in advance and let me know if I can provide any other information to better explain this.

    Shiftreport.JPG

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: How to reference Timevalue to change a cell's text to another text

    Hi, welcome to the forum

    Please upload a sample of your workbook, not a picture of your data. Pictures are pretty much impossible to edit, and no-one wants to re-type your data for you
    Also, not all members can upload picture files (Company firewalls and stuff)

    Your workbook should show a small desensitized example of the data you are working with and a manual mockup of the expected results.

    Having said that, perhaps you could build an IF() statement to test for Day/Night?

    =IF($I$3="Days",day-shift-formula","Night-shift-formula")
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    11-16-2014
    Location
    North America
    MS-Off Ver
    2013
    Posts
    8

    Re: How to reference Timevalue to change a cell's text to another text

    Thank you for the quick response FD!!! Attached is the worksheet I am working with. If you reference I3 you will see the formula I listed above that is obviously not working the way I intended it to lol. Sorry I didn't just upload the worksheet to begin with, it is attached now. I am open to any and all suggestions that can simplify this application. Again I am trying to make cell I3 automatically switch between Days and Nights by essentially setting up a limit between times.

    If I can get away with not having to reference the static times listed in O2, O3, P2, and P3 I would love to know how that can be accomplished, if not I am ok with keeping it, I really would just love for it to work period lol. Thanks again for the help!!


    EOS Report.xlsx
    Last edited by gutchek; 11-16-2014 at 08:58 PM.

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: How to reference Timevalue to change a cell's text to another text

    If all you want to do is ID which shift it is, try this...
    =IF(AND(MOD(D3,1)>=O2,MOD(D3,1)<=P2),"Days","Nights")

    You need to understand this about dates and time...a date is just a number indicating how many days have passed since 1/1/1900, so 7/11/14 is actually 41831. excel formats it into something that we recognise as a date

    Likewise with time...time is a decimal of 1 (day), so for instance 06:00 AM is actualy just 0.25, 12 noon is .05 and 06:00 PM (18:00) is 0.75. Again, excel formats it to something we see as a time


    Note that ny using NOW(), you are including the date, so you have something like 41831.50 for mid-day on 7/11/2014, but you would be comparing that to just 12:00 AM (mid-day) or 0.5 (Hope that made sense?)

  5. #5
    Registered User
    Join Date
    11-16-2014
    Location
    North America
    MS-Off Ver
    2013
    Posts
    8

    Re: How to reference Timevalue to change a cell's text to another text

    Thank you FD that worked perfectly!!!

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: How to reference Timevalue to change a cell's text to another text

    Glad it worked for you

+ 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. Change TimeValue to reference a Cell entered value instead
    By coreytroy in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-09-2013, 03:36 AM
  2. Replies: 2
    Last Post: 10-08-2012, 08:10 AM
  3. [SOLVED] How to change cell reference to text?
    By jasondu in forum Excel General
    Replies: 2
    Last Post: 06-11-2012, 04:47 PM
  4. Replies: 5
    Last Post: 01-10-2012, 11:20 AM
  5. [SOLVED] text color change in cell reference
    By TomKat743 in forum Excel General
    Replies: 3
    Last Post: 06-15-2005, 08:05 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