Search code examples
ms-wordmergefielddocx-mailmerge

MS Word mail merge: organise every nth record?


The Excel file has seven records (rows). I would like to organise every three records together. Yet, the following code returns a calculation error.

{ IF { =MOD({MERGESEQ},3) = 0} "{ MERGESEQ }: { MERGEFIELD _record}" "" }

How can I fix the error? Thank you for any help in advance!


Solution

  • It's probably because you have the = 0 inside the { = } field when it should be outside, like this:

    { IF { =MOD({MERGESEQ},3) } = 0 "{ MERGESEQ }: { MERGEFIELD _record}" "" }
    

    Another thing that could cause a syntax error is the case where your Windows regional settings require you to use ";" instead of "," as a list separator (i.e. in that case you would need

    { IF { =MOD({MERGESEQ};3) } = 0 "{ MERGESEQ }: { MERGEFIELD _record}" "" }