• More conditional mail merge

    Author
    Topic
    #476833

    I’m trying to do a mail merge using an excel spreadsheet as the data.

    I’m trying to skip records based on date field. Trouble is I don’t know the format of the data from excel. Being in the UK, the date format within Excel is dd/mm/yy. When I import the date into the mail merge it displays as mm/dd/yy. I’ve tried and it won’t recognise either of those formats or the numerical value of the excel date.

    Can anyone help please

    David

    Viewing 1 reply thread
    Author
    Replies
    • #1280816

      I managed to solve this one myself.

      In the same way you can format mergefields with the @ key, you can get Word to recognise formatted data.

      adding @”ddMMyy” to a date field will force Word to display the result for 29 May 2011 as 290511. Now if you want to skip any records not dated 29 May 2011 place the following rule at start of document:

      { SKIPIF {MERGEFIELD Date @”ddMMyy” }290511}

      Curly brackets added with Ctrl+F9

      David

    • #1280901

      Hi David,

      I’d suggest using a construct like:
      {SKIPIF{MERGEFIELD Date @ YYYYMMDD} “20110529”}
      This provides greater flexibility, in that with a change to the operator, the the comparison allows you to skip records before or after a specified date. And, with the combination of two SKIPIF fields, to specify a date range.

      Note: it’s not a good idea to have a data field named ‘Date’, because Word has a DATE field and there’s a risk of confusion.

      Cheers,
      Paul Edstein
      [Fmr MS MVP - Word]

    Viewing 1 reply thread
    Reply To: More conditional mail merge

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: