Ryan has attended:
Excel Advanced course
Mail Merge Entries combining
I am attempting to create a mail merge to selected recipients based on an Excel spreadsheet but in my tests, where I have multiple Excel lines for the same person, it is sending them multiple emails.
Ideally I would like to make this 1 email that captures every line's details for that recipient. E.g. If Person A has an overdue submission that I need to chase but it covers 3 different references, there needs to be 1 email covering all 3 references as opposed to 3 emails being sent that each relate to 1 individual reference.
Is this possible?
Many thanks,
Ryan
RE: Mail Merge Entries combining
Hello Ryan,
Thank you for your post. The best way to simplify your merge is to rebuild your Excel data records first, so that all references for the same person are in one row, potentially also in the same column in each row. To achieve this, you can use Excel's Power Query tool. Here are the steps to achieve this:
1. Load your data into Power Query:
- In Excel, select your data (including headers).
- Go to the Data tab and click From Table/Range to load it into Power Query.
2. Group by person:
- In Power Query, click on the Transform tab and select the Group By button.
- In the Group By dialogue, you’ll specify:
- Group by: Choose the column that identifies the person (e.g., Name, ID).
- New column name: You can name this something like "Reference Numbers."
- Operation: Select All Rows (this will collect all records for the same person into a table).
3. Merge the reference numbers:
After grouping the records:
- You’ll see a new column with nested tables (for each person).
- Click the expand icon (a small box with an arrow) next to the new column header.
- Select the column(s) that contain the reference numbers (or any other columns you want to merge) and click OK.
4. Concatenate reference numbers (if necessary):
If you want to concatenate all the reference numbers into a single cell for each person, you can do the following:
- Click on the column header that contains the reference numbers.
- Go to the Transform tab, and under Text Column, select Merge Columns.
- Choose a delimiter (e.g., comma, space) and click OK.
5. Finish and load the data back:
Once your data is merged as you need it, click Close & Load to return the transformed data to Excel.
Example: Let’s say you have this initial data:
| Name | Reference Number | Amount |
|-------|------------------|--------|
| Alice | R001 | 100 |
| Alice | R002 | 200 |
| Bob | R003 | 150 |
| Alice | R003 | 300 |
After applying these steps, you could get a result like this (if you merged the reference numbers):
| Name | Reference Numbers | Total Amount |
|-------|-----------------------|--------------|
| Alice | R001, R002, R003 | 600 |
| Bob | R003 | 150 |
This way, you’ve combined all records for the same person into a single row, with the reference numbers merged and other data aggregated.
I understand that you may not have worked with Power Query before, but if you follow the steps above carefully, it will hopefully work.
Now, in Word, it will be easier to create the merge containing one record per person with all their references.
Let me know if you need further clarification or details on any part!
Kind regards
Marius Barnard
STL