Mail Merge: concatenate fields with commas but do not want the commas to appear when no values

Mail Merge: concatenate fields with commas but do not want the commas to appear when no values

For a mail merge template I want to concatenate the fields with commas but do not want the commas to appear when no values?

example "A, B, C and D"
when B and C no values
should read as "A and D".

How is this achieved? Someone had asked it previously but I did not see an answer.