Using SkipIf with date problem

D

dragonballcity

I have a list of people in an excel spreadsheet according to date. Th
first column in the sheet is labeled Date and I manually enter the dat
as m/d/yyyy (so for today 2/24/12). I create letters using mail merg
in Word 2010 each day, but only want letters for people that are entere
into the spreadsheet the current day. I have the beginning of my lette
set up as
{ SKIPIF { MERGEFIELD Date } <> "{ DATE }" }

It's worked perfectly...until today. Today (2/24/12) when I merged th
letters they all came out, along with letters for people that wer
entered into the spreadsheet on 1/12/12. The only thing I can see i
1/12 when doubled is 2/24, otherwise I'm clueless. If I change the 1/1
people to 1/11 or 1/13 it works fine.

I tried changing my skip if to say
{ SKIPIF { MERGEFIELD Date } <> "{ DATE \@ "m\d\yyyy" }" but got th
same result.

I tried adding a second skip if
{ SKIPIF { MERGEFIELD Date } < "{ DATE }" } but still got the sam
result.

I ultimately went back and deleted the 1/12 people, merged the letters
then put them back into the spreadsheet. I don't want to have to d
that every time though.

Am I doing something wrong? Thanks in advance
 

macropod

Microsoft MVP
Joined
Mar 2, 2012
Messages
578
Reaction score
50
Hi dragonballcity,

To do date comparisons, the first thing you need to ensure is that both your MERGEFIELD and the DATE field are using the same date format. You can do this by adding format switches to both fields.

If you want to establish whether one date is earlier/later than the other, the required format switch is \@ YYYYMMDD. The same switch is useful for testing date equivalence also. Thus your SKIPIF test becomes:
{SKIPIF{MERGEFIELD Date \@ YYYYMMDD} <> {DATE \@ YYYYMMDD}}
This skips any records where the dates differ.

A field coded as:
{SKIPIF{MERGEFIELD Date \@ YYYYMMDD} = {DATE \@ YYYYMMDD}}
skips any records where the dates match and a field coded as:
{SKIPIF{MERGEFIELD Date \@ YYYYMMDD} > {DATE \@ YYYYMMDD}}
skips any records where the mergefield's date is later than today.
 

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