Mail Merge Alphanumeric Comparison Error

V M
V M used Ask the Experts™
on
MS Word mail merge rules seem unable to distinguish alphanumerics when the compared item leads with a numeral, e.g.:

Rule:      {skipif {mergefield "TRANS"} <> "351A"
Record:  TRANS = 351B
Result:    Record is NOT SKIPPED (but should be skipped[/b] because "351A" <> "351B")

but the following generates the correct result:

Rule:      {skipif {mergefield "TRANS"} <> "A351"
Record:  TRANS = 351B
Result:    Record IS SKIPPED

It seems to ignore characters after the last numeral, e.g.:

Rule:      {skipif {mergefield "TRANS"} <> "351"
Record:  TRANS = 351B
Result:    Record is NOT SKIPPED (but should be skipped[/b] because "351" <> "351B"

Is there some kind of fix for this?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Retired
Top Expert 2012
Commented:
Sorry to have neglected this for so long. Put quotes around the merge field so that it is treated as a text rather than numeric.
{skipif "{mergefield "TRANS"}" <> "351A"
V M

Author

Commented:
GrahamSkan, thank you!
V M

Author

Commented:
May I ask a related follow-up?

In simply trying to have my MS Word file draw data from a record in an Excel file,

I get the correct result when the data is numeric:

Rule:      {mergefield EXHIBIT_ID}
Record:  EXHIBIT_ID = 906
Result:    906

but, I get the incorrect result when the data is alphanumeric:

Rule:      {mergefield EXHIBIT_ID}
Record:  EXHIBIT_ID = 906A
Result:    0

I tried various combinations of  quotes ("s) to no avail.
V M

Author

Commented:
I found answer to my second question:

The problem was that MS Word MERGEFIELD function was not returning the alphanumeric data from the record.  This apparently was caused b the fact that the field from the underlying data file (Excel file) contained mixed data, i.e., some record had numeric data in that field, and some records had alphanumeric data in that field.  This apparently causes Word to treat the alphanumeric data  as zeroes.

SOLUTION: enter alphanumeric data in the FIRST RECORD in that data field.

https://social.msdn.microsoft.com/Forums/en-US/102c5fde-85ef-451e-8e68-181f329194d7/word-mail-merge-enters-quot0quot-zero-instead-of-text-into-merged-table-field

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial