#1
|
|||
|
|||
field value based on time of day
Greetings All, I have been trying to create a field in Word 2007 that will display "DAYSHIFT" before noon and "NIGHTSHIFT" after. This is rather difficult, since I can't find anywhere an explanation of how Word parses date/time values. To get around that, I have tried the two following field codes: {If Time \@"HH" < 12 "Dayshift" "Nightshift"} {If Time \@"am/pm" = am "Dayshift" "Nightshift"} Both of these yield the result "NIGHTSHIFT" now, and also when I switch the system time to AM. Can someone please tell me what I'm doing wrong? thanks. |
#2
|
||||
|
||||
Hi akraw, you can use either:
{IF{TIME \@ HH}< 12 "Night Shift" "Day Shift"} or: {IF{TIME \@ "AM/PM"}= "AM" "Night Shift" "Day Shift"} Note: The field brace pairs (ie '{ }') for the above examples are created via Ctrl-F9 - you can't simply type them or copy & paste them from this message.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Thank you! Unfortunately the am/pm version didn't work, but the other one did exactly what it was supposed to.
|
#4
|
||||
|
||||
Hi akraw,
I see you posted the same question at: http://answers.microsoft.com/en-us/office/forum/office_2007-word/calculate-field-value-based-on-time-of-day/f58000d9-de57-e011-8dfc-68b599b31bf5 where HansV provided an answer. For cross-posting etiquette, please see: http://www.excelguru.ca/node/7
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Add a period of time to a referenced "Time" cell? | derelyth | Excel | 4 | 03-27-2011 04:31 PM |
Look up an array based on user input | johnsmb | Excel | 2 | 01-07-2011 01:12 PM |
server based rules | Babs27 | Outlook | 1 | 01-01-2011 07:21 PM |
Selecting merge field based on whether or not text is present | amym | Mail Merge | 1 | 12-07-2010 05:14 AM |
How to refer a field in another field | DaveSmith | Word | 0 | 08-24-2010 06:44 PM |