Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-26-2011, 12:15 PM
akraw akraw is offline field value based on time of day Windows XP field value based on time of day Office 2007
Novice
field value based on time of day
 
Join Date: Mar 2011
Posts: 2
akraw is on a distinguished road
Default 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.
Reply With Quote
  #2  
Old 03-26-2011, 03:30 PM
macropod's Avatar
macropod macropod is offline field value based on time of day Windows 7 32bit field value based on time of day Office 2000
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
  #3  
Old 03-26-2011, 06:46 PM
akraw akraw is offline field value based on time of day Windows XP field value based on time of day Office 2007
Novice
field value based on time of day
 
Join Date: Mar 2011
Posts: 2
akraw is on a distinguished road
Default

Thank you! Unfortunately the am/pm version didn't work, but the other one did exactly what it was supposed to.
Reply With Quote
  #4  
Old 03-26-2011, 08:29 PM
macropod's Avatar
macropod macropod is offline field value based on time of day Windows 7 32bit field value based on time of day Office 2000
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
field value based on time of day 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
field value based on time of day 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

Other Forums: Access Forums

All times are GMT -7. The time now is 09:49 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft