Adding records to a custom sorted spreadsheet

daymaker

New Member
Joined
Feb 28, 2012
Messages
15
I have a spreadsheet that has been presorted by another application. In the current spreadsheet state, it only lists one order per customer. For many customers, we have more than one order during the year which are in a separate spreadsheet. We are wanting to add in the other orders per customer without disturbing the current sort order as it is required for proper distribution of a letter to each customer. We will then be able to draft an order summary list for each customer from the full order list & print them in the presorted order.

So I was thinking about assigning a key field to the current customer list in its sort order and then copying the entire customer/order list into a second worksheet and then comparing the two worksheets via a column in this second worksheet & add the same key per customer. I would then sort this second worksheet by this key, which would result in all records per customer being in the same order as the current spreadsheet.

Here are sample sheet images to illustrate -

Spreadsheet that has no multiple orders per customer; in the sort that needs to stay in:

Dummyexcelpresortadd_nodupes.jpg



Spreadsheet that has multiple orders per customer; in basic alphanumeric order by 'company':

Dummyexcelpresortadd_dupesalpha.jpg


As you can see, all company names listed on first sheet are present on second at least once while several have multiple orders per company.

Maybe there is a better way than my general logic. I'm looking for formulas/macros to get this sort of thing accomplished.

Thanks for any help!

John
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
And here is image of what the spreadsheet would look like after inserting the additional records:

Dummyexcelpresortadd_dupes.jpg
 
Upvote 0
Hi John,

Your general approach seems okay to me.

Using a formula like the one shown below might streamline your process.

If we assume the Worksheet with No Multiple Orders is named "CustomOrder", then enter this formula in Cell C2 of the Sheet with Multiple Orders, and copy down:

=MATCH($B2,CustomOrder!$B:$B,0)

Now you should be able to sort that sheet by Column C and the order will match your Custom Sort Order.
 
Upvote 0

Forum statistics

Threads
1,215,379
Messages
6,124,608
Members
449,174
Latest member
ExcelfromGermany

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