Share via

Using SkipIf with date problem

Anonymous
2012-02-24T17:38:25+00:00

I have a list of people in an excel spreadsheet according to date. The first column in the sheet is labeled Date and I manually enter the date as m/d/yyyy (so for today 2/24/12). I create letters using mail merge in Word 2010 each day, but only want letters for people that are entered into the spreadsheet the current day. I have the beginning of my letter set up as

{ SKIPIF { MERGEFIELD Date } "{ DATE }" }

It's worked perfectly...until today. Today (2/24/12) when I merged the letters they all came out, along with letters for people that were entered into the spreadsheet on 1/12/12. The only thing I can see is 1/12 when doubled is 2/24, otherwise I'm clueless. If I change the 1/12 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 the same result.

I tried adding a second skip if

{ SKIPIF { MERGEFIELD Date } "{ DATE }" } but still got the same 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 do that every time though.

Am I doing something wrong? Thanks in advance.

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Paul Edstein 82,861 Reputation points Volunteer Moderator
2012-02-28T06:13:18+00:00

Hi dbcity,

The reason for using field switch to specify the date format is to ensure the output from your mergefield matches the format of the output from the date field. Since you're only testing whether the dates are the same, you could use YYYYMMDD, MMDDYYYY, MMYYYYDD, etc. Provided you have DD, MM and YYYY, it really doesn't matter what order they appear in this case. YYYYMMDD is necessary if you want to test whether one date might be before or after the other one, though.

Was this answer helpful?

0 comments No comments

Answer accepted by question author

HansV 462.6K Reputation points
2012-02-24T21:41:52+00:00

There shoud be an = between the merge field and the date:

{ SKIPIF { MERGEFIELD Date } = "{ DATE }" }

Was this answer helpful?

0 comments No comments

4 additional answers

Sort by: Most helpful
  1. Anonymous
    2012-02-25T07:05:30+00:00

    When comparing dates in fields change them to yyyyMMdd format first thus

    {SKIPIF {Mergefield Date @ "yyyyMMdd" } <> {Date @ "yyyyMMdd"} }

    You can also use this method to check whether a date preceeds or follows another date.

    See also http://www.gmayor.com/formatting_word_fields.htm

    Was this answer helpful?

    0 comments No comments
  2. HansV 462.6K Reputation points
    2012-02-24T22:07:53+00:00

    Sorry, yes - use <> instead of =

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2012-02-24T21:47:23+00:00

    If I did that, wouldn't it skip the ones that ARE the current date?  Those are the ones I want to use. Thanks!

    Was this answer helpful?

    0 comments No comments