Forumula / Macro required to create automated billing and then Mail merge

citibond

New Member
Joined
Sep 12, 2014
Messages
3
I have two spreadsheet one is my main spreadsheet which contains user details and email addresses, the other is a monthly downloaded spreadsheet which contains itemised listing for calls. I need to send each user an email each month with their itemised call list and total. We have been using a manual process until now and would like to automate it.

Spreadsheet 1 Fields

[TABLE="width: 500"]
<tbody>[TR]
[TD]Tel No[/TD]
[TD]Name[/TD]
[TD]Dept[/TD]
[TD]Contract Type[/TD]
[TD]Expiry[/TD]
[TD]Model[/TD]
[TD]Line Rental[/TD]
[TD]Email Address[/TD]
[/TR]
[TR]
[TD]09092222[/TD]
[TD]XYZ[/TD]
[TD]XXX[/TD]
[TD]Blackberry[/TD]
[TD]23/09/2014[/TD]
[TD]9790[/TD]
[TD]10[/TD]
[TD]xyz@gmail.com[/TD]
[/TR]
[TR]
[TD]09088888[/TD]
[TD]YYY[/TD]
[TD]YYY[/TD]
[TD]Iphone[/TD]
[TD]23/08/2015[/TD]
[TD]4[/TD]
[TD]15[/TD]
[TD]yyy@gmail.com[/TD]
[/TR]
</tbody>[/TABLE]

Spreadsheet 2
[TABLE="width: 500"]
<tbody>[TR]
[TD]Tel No[/TD]
[TD]Number Called[/TD]
[TD]Duration[/TD]
[TD]Cost[/TD]
[/TR]
[TR]
[TD]09092222[/TD]
[TD]6565625256[/TD]
[TD]00:01:54[/TD]
[TD]0.23[/TD]
[/TR]
[TR]
[TD]09092222[/TD]
[TD]6871268618[/TD]
[TD]00:03:32[/TD]
[TD]0.34[/TD]
[/TR]
[TR]
[TD]09088888[/TD]
[TD]7681276817[/TD]
[TD]00:04:01[/TD]
[TD]0.20[/TD]
[/TR]
[TR]
[TD]09092222[/TD]
[TD]8767378783[/TD]
[TD]00:01:03[/TD]
[TD]0.30[/TD]
[/TR]
[TR]
[TD]09088888[/TD]
[TD]87289798279[/TD]
[TD]00:08:03[/TD]
[TD]0.67[/TD]
[/TR]
</tbody>[/TABLE]

We use a vlookup to transfer the details from spreadsheet 1 to a excel invoice, but can't work out how to do a vlookup for spreadhseet 2 based on the number and also how to email automatically.
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
for spreadsheet2 make a pivot table that will list every unique number and in the central box put sum of cost

then use your vlookup directly onto the pivot table

take out all subtotals and grand totals for clarity
 
Upvote 0
I have tried the above but it only returns the top value in the pivot table. I need all the column results from spreadsheet 2 to be included in the invoice
 
Upvote 0
[TABLE="width: 1013"]
<colgroup><col><col><col><col span="2"><col><col span="3"><col><col span="4"></colgroup><tbody>[TR]
[TD]Tel No[/TD]
[TD]Number Called[/TD]
[TD]Duration[/TD]
[TD]Cost[/TD]
[TD][/TD]
[TD]Tel No[/TD]
[TD]Name[/TD]
[TD]Dept[/TD]
[TD]Contract Type[/TD]
[TD]Expiry[/TD]
[TD]Model[/TD]
[TD]Line Rental[/TD]
[TD="colspan: 2"]Email Address[/TD]
[/TR]
[TR]
[TD="align: right"]9092222[/TD]
[TD="align: right"]6565625256[/TD]
[TD="align: right"]00:01:54[/TD]
[TD="align: right"]0.23[/TD]
[TD][/TD]
[TD="align: right"]1234567[/TD]
[TD]fred[/TD]
[TD]dept1[/TD]
[TD]Iberry[/TD]
[TD="align: right"]16/09/2015[/TD]
[TD="align: right"]999[/TD]
[TD="align: right"]22[/TD]
[TD="colspan: 2"]fred@gmail.com[/TD]
[/TR]
[TR]
[TD="align: right"]9092222[/TD]
[TD="align: right"]6871268618[/TD]
[TD="align: right"]00:03:32[/TD]
[TD="align: right"]0.34[/TD]
[TD][/TD]
[TD="align: right"]9088888[/TD]
[TD]YYY[/TD]
[TD]YYY[/TD]
[TD]Iphone[/TD]
[TD="align: right"]23/08/2015[/TD]
[TD="align: right"]4[/TD]
[TD="align: right"]15[/TD]
[TD="colspan: 2"]yyy@gmail.com[/TD]
[/TR]
[TR]
[TD="align: right"]9088888[/TD]
[TD="align: right"]7681276817[/TD]
[TD="align: right"]00:04:01[/TD]
[TD="align: right"]0.2[/TD]
[TD][/TD]
[TD="align: right"]9092222[/TD]
[TD]XYZ[/TD]
[TD]XXX[/TD]
[TD]Blackberry[/TD]
[TD="align: right"]23/09/2014[/TD]
[TD="align: right"]9790[/TD]
[TD="align: right"]10[/TD]
[TD="colspan: 2"]xyz@gmail.com[/TD]
[/TR]
[TR]
[TD="align: right"]9092222[/TD]
[TD="align: right"]8767378783[/TD]
[TD="align: right"]00:01:03[/TD]
[TD="align: right"]0.3[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]9088888[/TD]
[TD="align: right"]8.729E+10[/TD]
[TD="align: right"]00:08:03[/TD]
[TD="align: right"]0.67[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]1234567[/TD]
[TD="align: right"]9876543[/TD]
[TD="align: right"]00:06:53[/TD]
[TD="align: right"]1.23[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Sum of Cost[/TD]
[TD] [/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Tel No[/TD]
[TD]Total[/TD]
[TD][/TD]
[TD][/TD]
[TD]############[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]1234567[/TD]
[TD="align: right"]1.23[/TD]
[TD][/TD]
[TD][/TD]
[TD]fred@gmail.com[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]9088888[/TD]
[TD="align: right"]0.87[/TD]
[TD][/TD]
[TD][/TD]
[TD]yyy@gmail.com[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]9092222[/TD]
[TD="align: right"]0.87[/TD]
[TD][/TD]
[TD][/TD]
[TD]xyz@gmail.com[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Grand Total[/TD]
[TD="align: right"]2.97[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD="colspan: 3"]formula in cellbelow #########[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD="colspan: 6"]=IF(B16="","",IF(B16="Grand Total","",VLOOKUP(B16,mytable,8)))[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0

Forum statistics

Threads
1,223,577
Messages
6,173,163
Members
452,503
Latest member
AM74

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top