The problem is this, when I get data from a client sometimes multi-select pick list fields are seperated into different rows of the excel file, like this.
ID Pick List Value
ABC123 Cat
ABC123 Dog
ABC123 Bird
DEF456 Cat
DEF456 Bird
XYZ789 Cat
XYZ789 Dog
XYZ789 Bird
For data loader we need this to be in a forma like this:
ID Pick List ValueThe first things that needs to be done is the ID column needs to be sorted in alphabetical order. From there I wrote an Excel formula that says IF(the ID in this column and the one above it match, Concatenate the value in this column with the one in the cell directly above it separating them with a ';', otherwise just give me the value in the in this column).
ACB123 Cat;Dog;Bird
DEF456 Cat;Bird
XYZ789 Cat;Dog;Bird
The Excel formula looks like this and would go in the cell directly to the right of the pick list value field above.
=IF(A2=A1,CONCATENATE(B1,";",C2),B2)Next things get a bit tricky. We need to somehow remove the columns that we are not going to be using (we could just import the list as it is because it would overwrite the field as many times over until it hit the largest one, but it would make sense to have a spreadsheet that just had the values we are using.)
Add a new column to the left of the formula field called 'Length'. add the formula =LEN(C2) and fill it to the end of the spreadsheet. Next sort this value largest to smallest, then resort the ID's into alphabetical order, this will put them in an order that groups them by ID number ordered by the full list of options first going down to just one option.
Next we need to remove duplicates based on the ID number. Select the entire spreadsheet and select 'Remove Duplicates' deselect all columns except for the ID column, then click OK.
This will leave you with a fully concatenated list of values that only displays one record for each ID!
Slight error in the above formula. Otherwise pretty awesome. =IF(A2=A1,CONCATENATE(C1,";",B2),B2)
ReplyDelete