How to reference a repeated field entry in a previous record

F

Frustrated

I figured out an easy way to refer back to the previous record in a merge so
as not to enter the same information twice.

I set up a column in the spreadsheet next to the column holding the field I
wanted to reference. I then used the "EXACT" formula to compare the field
text in the record above with the one below to see if they were the same
(i.e. TRUE) or different (i.e. FALSE) I then copied the formula all the way
down the column.

Then I used the 'IF-Then-Else" field in my Word merge document: {IF
{Mergefield TFC} = "FALSE" "{Mergefield Country}" " "}.

Works like a charm!

Thankfully, I will not need to use a macro to go back and delete the
unwanted repeated text.
 
M

macropod

Hi,

You could build the logic for this into the Word mailmerge document itself,
thus avoiding the need to edit the spreadsheet.

To do this, you could use a SET field to save the value of the previous
record, and a REF field to access that value before updating with the new
value.

You might need to do something special for the first record, along the lines
of:
{IF {MERGEREC}= 1 {SET oldvalue ""}}

From then on, to test the "old" value, you could use:
{IF{Mergefield TFC} = {oldvalue} {Mergefield Country}}

Having done that, you update the "old" value with the "new" value:
{SET oldvalue {MERGEFIELD TFC}}
for use in the next record.

Cheers
 
F

Frustrated

Thanks for the tip....I'll give it a try!

macropod said:
Hi,

You could build the logic for this into the Word mailmerge document itself,
thus avoiding the need to edit the spreadsheet.

To do this, you could use a SET field to save the value of the previous
record, and a REF field to access that value before updating with the new
value.

You might need to do something special for the first record, along the lines
of:
{IF {MERGEREC}= 1 {SET oldvalue ""}}

From then on, to test the "old" value, you could use:
{IF{Mergefield TFC} = {oldvalue} {Mergefield Country}}

Having done that, you update the "old" value with the "new" value:
{SET oldvalue {MERGEFIELD TFC}}
for use in the next record.

Cheers
 
F

Frustrated

Thank you...it worked! However, it was even simpler than your suggestion.

I used the SET field at the end of my merge codes to define the reference,
and the IF THEN ELSE field to determine the change in Country name:

{IF {MERGE REC} = 1 "{MERGEFIELD Country}" "{IF {MERGEFIELD Country} =
"{Oldvalue}" " " " {MERGEFIELD Country}"}"}

{SET Oldvalue "{MERGEFIELD Country}"

I had tried something similar earlier, but had used my "SET" field BEFORE
the "IF THEN ELSE" field which negated the results.

Now it works like a charm without altering my spreadsheet!
 

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