Use of "OR" and "AND" in a merged document?

T

Tosca

Hi everyone

I have an Excel sheet which contains data. I have a column which has days
of the week, either as individual days or combinations, such as Mo, We, Tu -
Th, Sa - Su etc. I have managed to set up a merge (into Word 2003) that
works but I'd like to add a Skipif field to compare today with what is in
the Day column in the Excel sheet. I'd like to be able to list the data in
the merge which only meets the criteria set in the Skipif field. If it's
Tuesday, I'd like to list only data which has, for instance, Tu or Mo - Th
in the Excel day column. The Skipif field would have to be something like
"Skipif(OR(DATE=Tu),(DATE=Mo - Th))" which is similar to the format that I
have used in other MS Office applications. As I mentioned in the Subject
line, I'd like to be able to use "AND" also. I know there's a "COMPARE"
field in Word 2003 and suspect that I may have to use this but I don't know
how. I hope there's no restriction on the number of "IF"s that I can nest
as there is a limit of 7 in Excel!

Thanks for your time.
 
G

Graham Mayor

Try

{ IF{ Mergefield Datefield \@ "ddd" } = { Date \@ "ddd" } "Put the
information you want to display here" }

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
T

Tosca

Thank you Graham. I managed to do what I want:

{ SKIPIF { = OR ( { COMPARE {MERGEFIELD Day } = "Mo" }, { COMPARE {
MERGEFIELD Day } = "Mo - We" } ) } = 1

This skips the record when merging if the data field "Day" contains the text
"Mo" or "Mo - We". I realise that I can use a final " = 0" rather than " =
1" if I want to skip everything except "Mo" or "Mo - We". I can also use "
= AND" if the circumstances require it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top