lundi 20 novembre 2017

exporting data to table for mail merge

Sorry I may make this more overcomplicated than it needs to be!

Basically i'm trying to extract some data from an Excel spreadsheet and put it into a table to print off labels, So for example i have a product A the customer name is Ted and they have ordered 6 items that need a custom name written on them.

I have the spreadsheet set up but i need a method of only printing labels that have actually been used (they are a page of 12 labels)

The table looks like the following

product customer amount
A   ted     6
B   bob     3
C   phil    5
D   lance   8
E   carl    6
F   terry   3
G   stu     1
H   pinky   1
I   joe     5
J   neil    4
K   frank   3
L   bruno   6
M   pizza   7

With an ID table lookup

Ids     
A   B   C
A1  HG  HG
TE  DF  RTT
DS  RE  DS
CS      AC
GD      V
HG      

So in the end i would have the following:

Product A, Ted, A1
Product A, Ted, TE
Product A, Ted, Ds
Product A, Ted, CS
Product A, Ted, GD
Product A, Ted, HG
Product B, Bob, HG
etc

I was thinking of using If statements to see if there is a value for each item in the amount if there is create a new line grabbing the needed data as above and placing it into a new table that can be imported into a mail merge or similar?

Does anyone have any better ways of doing this and any tidbits of ideas for code?

Thanks,

Aucun commentaire:

Enregistrer un commentaire