A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » Tables
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

If statement with dates



 
 
Thread Tools Display Modes
  #1  
Old February 14th, 2006, 11:54 PM posted to microsoft.public.word.tables
external usenet poster
 
Posts: n/a
Default If statement with dates

I have tried various iterations and have not been able to find a
solution.

We use a program to insert bookmarks into word from an SQL server. One
of the fields is a date and it is either a date or an empty field. I
am trying to get the date to display if there is one and an "N/A" if
there is not.

I have tried the following

{ =if imported_date 0 imported_date N/A}

I've tried it with { } around the bookmarks and " " and all sorts of
switches. I even tried converting the date to a different format
yyyyMMdd and comparing it.

Please somebody help.

Thanks,

Ryan



  #2  
Old February 15th, 2006, 06:32 PM posted to microsoft.public.word.tables
external usenet poster
 
Posts: n/a
Default If statement with dates

Hi Ryan,

What does the program insert if the date in the database is empty? Is it an
empty bookmark? If so, the field you need is this:

{ IF {imported_date} "" {imported_date} "N/A"}

To get the braces around the bookmark name nested inside the IF field, you
MUST use Ctrl+F9 -- you can't just type the braces on the keyboard.

What this says is:

- Evaluate the content of the bookmark named imported_date.
- If that content is not an empty string (represented by ""), then show the
content of the bookmark.
- If that content is an empty string, then show the string "N/A".

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

word wrote:
I have tried various iterations and have not been able to find a
solution.

We use a program to insert bookmarks into word from an SQL server.
One of the fields is a date and it is either a date or an empty
field. I am trying to get the date to display if there is one and an
"N/A" if there is not.

I have tried the following

{ =if imported_date 0 imported_date N/A}

I've tried it with { } around the bookmarks and " " and all sorts of
switches. I even tried converting the date to a different format
yyyyMMdd and comparing it.

Please somebody help.

Thanks,

Ryan




  #3  
Old February 15th, 2006, 08:23 PM posted to microsoft.public.word.tables
external usenet poster
 
Posts: n/a
Default If statement with dates

Thanks very much, but it does not work as you've typed it. The
bookmark is blank, but I get a syntax error still. It seems like it
should work based on everything I have read.

Here is what I have typed in (using Ctrl-F9 when needed)

{ if {Contract Date} "" {Contract Date} "N/A" }

It gives me an undefined bookmark error. So I took out the braces and
it doesn't give me an error, but is blank. The bookmark is empty when
I see the contents with the brackets [].

I would be happy to pay for consulting services if someone would tackle
this issue for me.

  #4  
Old February 15th, 2006, 08:32 PM posted to microsoft.public.word.tables
external usenet poster
 
Posts: n/a
Default If statement with dates

Bookmark names cannot have spaces in them so what is "Contract Date"?

--
Enjoy,
Tony


"word" wrote in message
oups.com...
Thanks very much, but it does not work as you've typed it. The
bookmark is blank, but I get a syntax error still. It seems like it
should work based on everything I have read.

Here is what I have typed in (using Ctrl-F9 when needed)

{ if {Contract Date} "" {Contract Date} "N/A" }

It gives me an undefined bookmark error. So I took out the braces and
it doesn't give me an error, but is blank. The bookmark is empty when
I see the contents with the brackets [].

I would be happy to pay for consulting services if someone would tackle
this issue for me.



  #5  
Old February 15th, 2006, 09:30 PM posted to microsoft.public.word.tables
external usenet poster
 
Posts: n/a
Default If statement with dates

Well, the database program allows us to insert bookmarks into the word
documents using a customized bookmark assistant program. I don't know
technically how they do it, just that it works like that. We go
through a template document and place these bookmarks where we have
dynamic information that needs to be populated. I've used bookmarks
within the word tables for calculations, so I don't think it has
anything to do with a space in the name.

I'm as confused about this as anybody, seems like half the time my
calcs work, half the time they don't.

  #6  
Old February 15th, 2006, 09:53 PM posted to microsoft.public.word.tables
external usenet poster
 
Posts: n/a
Default If statement with dates

I suspect it's looking for a bookmark called "Contract" - and not finding
one.

Can you look at your bookmarks under Insert Bookmarks and see what there
is?

--
Enjoy,
Tony


"word" wrote in message
oups.com...
Well, the database program allows us to insert bookmarks into the word
documents using a customized bookmark assistant program. I don't know
technically how they do it, just that it works like that. We go
through a template document and place these bookmarks where we have
dynamic information that needs to be populated. I've used bookmarks
within the word tables for calculations, so I don't think it has
anything to do with a space in the name.

I'm as confused about this as anybody, seems like half the time my
calcs work, half the time they don't.



  #7  
Old February 15th, 2006, 11:38 PM posted to microsoft.public.word.tables
external usenet poster
 
Posts: n/a
Default If statement with dates

Perhaps the bookmark is actually "Contract_Date"?

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

"Tony Jollans" My Forename at My Surname dot com wrote in message
...
I suspect it's looking for a bookmark called "Contract" - and not finding
one.

Can you look at your bookmarks under Insert Bookmarks and see what

there
is?

--
Enjoy,
Tony


"word" wrote in message
oups.com...
Well, the database program allows us to insert bookmarks into the word
documents using a customized bookmark assistant program. I don't know
technically how they do it, just that it works like that. We go
through a template document and place these bookmarks where we have
dynamic information that needs to be populated. I've used bookmarks
within the word tables for calculations, so I don't think it has
anything to do with a space in the name.

I'm as confused about this as anybody, seems like half the time my
calcs work, half the time they don't.




  #8  
Old February 16th, 2006, 06:19 PM posted to microsoft.public.word.tables
external usenet poster
 
Posts: n/a
Default If statement with dates

The bookmark is actually kf50e52e783c6487a96 but is actually being
inserted as Contract Date so that I know what it is. Once again, I
don't know how all of this works with the SQL server, but a program
called boomark assistant allows me to place these named bookmarks
throughout the document.

The search continues and I appreciate all the input.

Ryan

  #9  
Old February 16th, 2006, 06:29 PM posted to microsoft.public.word.tables
external usenet poster
 
Posts: n/a
Default If statement with dates

If you're going to manually edit the results of another program you're going
to have to use whatever it generates. In this case it looks like you will
need ..

{ if {kf50e52e783c6487a96} "" {kf50e52e783c6487a96} "N/A" }

This may give you some maintainability problems - depending on how your
bookmark assistant works - I don't know.

--
Enjoy,
Tony


"word" wrote in message
oups.com...
The bookmark is actually kf50e52e783c6487a96 but is actually being
inserted as Contract Date so that I know what it is. Once again, I
don't know how all of this works with the SQL server, but a program
called boomark assistant allows me to place these named bookmarks
throughout the document.

The search continues and I appreciate all the input.

Ryan



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
FY dates vs. CY dates Tammy General Discussion 1 December 31st, 2005 06:57 AM
If Statement and Dates Toys Worksheet Functions 5 December 21st, 2005 01:30 PM
converting dates into numbers kikilein General Discussion 2 October 20th, 2004 07:33 PM
dates and between statement gaxmancCO Using Forms 1 September 9th, 2004 10:45 PM
Change Start Dates without Changing Due Dates Beth General Discussion 0 August 19th, 2004 03:44 PM


All times are GMT +1. The time now is 12:27 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.