# Excel question - sorting data from one worksheet into multiple worksheets

**URL:** <https://boards.straightdope.com/t/excel-question-sorting-data-from-one-worksheet-into-multiple-worksheets/728264>\
**Category:** Factual Questions\
**Created:** [August 19, 2015, 2:23pm UTC](https://boards.straightdope.com/t/excel-question-sorting-data-from-one-worksheet-into-multiple-worksheets/728264 "2015-08-19T14:23:41Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![StGermain](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/stgermain/32/2868_2.png) [@StGermain](https://boards.straightdope.com/u/StGermain)\
**Post date:** [August 19, 2015, 2:23pm UTC](https://boards.straightdope.com/t/excel-question-sorting-data-from-one-worksheet-into-multiple-worksheets/728264/1 "2015-08-19T14:23:41Z")

</div>

Is there a way to do a slicer or a sort to take a spreadsheet that contains sales data for multiple accounts and copy each account’s data onto a separate tab?

Thanks!

StG

---

<div class="post-metadata">

**Author:** ![bump](https://avatars.discourse-cdn.com/v4/letter/b/7c8e57/32.png) [@bump](https://boards.straightdope.com/u/bump)\
**Post date:** [August 19, 2015, 2:38pm UTC](https://boards.straightdope.com/t/excel-question-sorting-data-from-one-worksheet-into-multiple-worksheets/728264/2 "2015-08-19T14:38:34Z")

</div>

I know the VLOOKUP function works across different tabs in a spreadsheet, so maybe you could set up all your tabs ahead of time, and use the VLOOKUP function to only grab the data pertinent to that tab?

---

<div class="post-metadata">

**Author:** ![StGermain](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/stgermain/32/2868_2.png) [@StGermain](https://boards.straightdope.com/u/StGermain)\
**Post date:** [August 19, 2015, 3:06pm UTC](https://boards.straightdope.com/t/excel-question-sorting-data-from-one-worksheet-into-multiple-worksheets/728264/3 "2015-08-19T15:06:24Z")

</div>

I’m not getting that to work. I can VLOOKUP on the account number, but it only pulls the first hit on the master sheet. Maybe there’s a different way you’re talking about?

StG

---

<div class="post-metadata">

**Author:** ![TroutMan](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/troutman/32/6721_2.png) [@TroutMan](https://boards.straightdope.com/u/TroutMan)\
**Post date:** [August 19, 2015, 3:17pm UTC](https://boards.straightdope.com/t/excel-question-sorting-data-from-one-worksheet-into-multiple-worksheets/728264/4 "2015-08-19T15:17:40Z")

</div>

Create a PivotTable on a new worksheet (tab), copy that worksheet for each sales account, then filter by the desired sales account on each worksheet.

---

<div class="post-metadata">

**Author:** ![StGermain](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/stgermain/32/2868_2.png) [@StGermain](https://boards.straightdope.com/u/StGermain)\
**Post date:** [August 19, 2015, 3:28pm UTC](https://boards.straightdope.com/t/excel-question-sorting-data-from-one-worksheet-into-multiple-worksheets/728264/5 "2015-08-19T15:28:34Z")

</div>

**Troutman** - Yep. that would work. Not as efficient has the (non-existent) function I had in my mind, but definitely doable.

StG

---

<div class="post-metadata">

**Author:** ![Disgscen](https://avatars.discourse-cdn.com/v4/letter/d/f05b48/32.png) [@Disgscen](https://boards.straightdope.com/u/Disgscen)\
**Post date:** [August 19, 2015, 10:07pm UTC](https://boards.straightdope.com/t/excel-question-sorting-data-from-one-worksheet-into-multiple-worksheets/728264/6 "2015-08-19T22:07:30Z")

</div>

I have a similar situation, in which accounts are split by a value in Column A, and I output a workbook for each unique value, using VBA.

I could give you some code tomorrow if you’re interested, but it basically sorts by column A, then looks through the rows for matching values, and copies those rows into a new spreadsheet. Doing it with tabs instead would be easier, in most ways.

---

<div class="post-metadata">

**Author:** ![Reply](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/reply/32/15952_2.png) [@Reply](https://boards.straightdope.com/u/Reply)\
**Post date:** [August 20, 2015, 6:39am UTC](https://boards.straightdope.com/t/excel-question-sorting-data-from-one-worksheet-into-multiple-worksheets/728264/7 "2015-08-20T06:39:35Z")

</div>

This is one of those things that Google Sheets might be better at. It’s super simple:

```auto

=filter(range, account_id=12345)

```

Example: [Accounts In Multiple Tabs - Google Sheets](https://docs.google.com/spreadsheets/d/1YyQg4hEwZCGaobOH1zxFGAERHE1I1zutftkU2DJ4QDU/edit?usp=sharing)

Excel is better for some things (visualizations, for example), but its data parsing functions are relatively primitive compared to Google Sheet’s. You can import your Excel sheet and see if Google works better… it’s free.

---

<div class="post-metadata">

**Author:** ![Boyo\_Jim](https://avatars.discourse-cdn.com/v4/letter/b/87869e/32.png) [@Boyo\_Jim](https://boards.straightdope.com/u/Boyo_Jim)\
**Post date:** [August 20, 2015, 7:02pm UTC](https://boards.straightdope.com/t/excel-question-sorting-data-from-one-worksheet-into-multiple-worksheets/728264/8 "2015-08-20T19:02:58Z")

</div>

> [@StGermain](#):
>
> I’m not getting that to work. I can VLOOKUP on the account number, but it only pulls the first hit on the master sheet. Maybe there’s a different way you’re talking about?
> 
> StG

I don’t know if the suggestion will work, but did you have multiple worksheets selected rather than just the master sheet?

---

<div class="post-metadata">

**Author:** ![Skammer](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/skammer/32/143_2.png) [@Skammer](https://boards.straightdope.com/u/Skammer)\
**Post date:** [August 20, 2015, 8:12pm UTC](https://boards.straightdope.com/t/excel-question-sorting-data-from-one-worksheet-into-multiple-worksheets/728264/9 "2015-08-20T20:12:20Z")

</div>

I did something similar not too long ago and ended up writing a macro in VBA to do it. I can find the code if you’re interested. This one took a list of records and sorted them to worksheets based on what State they were for (Georgia, Iowa, etc).
