+ Reply to Thread
Results 1 to 7 of 7

Sorting Sales by Zip Codes - Need the Subtotal for 3 Seperate Territories

  1. #1
    Registered User
    Join Date
    04-12-2021
    Location
    OH, USA
    MS-Off Ver
    365
    Posts
    3

    Sorting Sales by Zip Codes - Need the Subtotal for 3 Seperate Territories

    Hi everyone! Looking for help as I am stuck up until this point on a recent project I've been working on. I am trying to sort sales into our different territories by their zip codes. I have all U.S. zip codes that correspond with the said territories laid out into 3 different sheets. What is the best, most automated, way to give me the total of each territory by matching the subtotal & bill to zip code with the 3 other sheets that include a list of all zip codes within their respective territory. The goal is to upload our sales with their bill to zip and run a report each month. Looking for an automated way to upload those two factors each month and for excel to give me a total in each of the 3 terriories. Also, in the future I may expand to include more territories but I assume the same formula will apply. I cannot post a minisheet due to too many cells so I hope a picture can suffice. I will upload or PM a .xlsx or .csv file for those who need it to help me. Thanks!

    EDIT: See the attached sample workbook instead of images.
    Attached Files Attached Files
    Last edited by HermeScherme; 04-12-2021 at 03:38 PM.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,371

    Re: Sorting Sales by Zip Codes - Need the Subtotal for 3 Seperate Territories

    A picture is pretty useless for us to determine a solution. Post a sample workbook. See the yellow banner at the top of the page.

    Probably easiest to insert a Pivot Table. Then you can analyse to your heart’s content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    04-12-2021
    Location
    OH, USA
    MS-Off Ver
    365
    Posts
    3

    Re: Sorting Sales by Zip Codes - Need the Subtotal for 3 Seperate Territories

    Just edited to add a sample workbook. I've tried a pivot table. The issue is that it gives me the sum for each bill to zip code rather than the total for one of the three terriorties based on its zip code list. Is there a way to do that? We also sell to other zip codes that do not need to be analyized and attached to those three territories.

  4. #4
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,533

    Re: Sorting Sales by Zip Codes - Need the Subtotal for 3 Seperate Territories

    As you are using the 365 version of Excel you could use Power Query and Power Pivot.
    1. Convert all ranges to tables
    2. Use Power Query to combine the tables from the territory sheets using the following advanced editor code:
    Please Login or Register  to view this content.
    3. Choose Close and Load to: > select connection only and add to data model
    4. Add the table on the Sales with Zip sheet to the data model
    5. From the diagram view in the data model connect Zip to Bill to Zip (should automatically form a one to many connection)
    6. Produce a pivot table, as modeled on the PT sheet, using the territory field from Query1 (the combined territories table) and Subtotal.
    The linked video may also help: https://www.youtube.com/watch?v=jVkWDZ7B-Zs
    Let us know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  5. #5
    Registered User
    Join Date
    04-12-2021
    Location
    OH, USA
    MS-Off Ver
    365
    Posts
    3

    Re: Sorting Sales by Zip Codes - Need the Subtotal for 3 Seperate Territories

    JeteMc, thank you very much for your time and assistance. This is exactly what we wish to do. However, I couldn't replicate what you created by following your steps and code. I even tried updating the variables (subtotal, bill to zip) on your attached file and errors came up. Is there any further suggestions for me at this point? Again, thanks for your time.

  6. #6
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,862

    Re: Sorting Sales by Zip Codes - Need the Subtotal for 3 Seperate Territories

    Power Query is a free AddIn for Excel 2010 and 2013, and is built-in functionality from Excel 2016 onwards (where it is referred to as "Get & Transform Data").

    It is a powerful yet simple way of getting, changing and using data from a broad variety of sources, creating steps which may be easily repeated and refreshed. I strongly recommend learning how to use Power Query - it's among the most powerful functionalities of Excel.

    - Follow this link to learn how to install Power Query in Excel 2010 / 2013.

    - Follow this link for an introduction to Power Query functionality.

    - Follow this link for a video which demonstrates how to use Power Query code provided.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  7. #7
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,533

    Re: Sorting Sales by Zip Codes - Need the Subtotal for 3 Seperate Territories

    When attempting to Refresh the pivot table I got a message about blanks in the Zip column of the Query1 table so I have added a step to the Advanced Editor code to remove blanks:
    Please Login or Register  to view this content.
    Hopefully this will solve the issue.
    Let us know if you have any questions.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Sorting by Alpha, Adding Subtotal - then removing subtotal - variable data sets
    By gregg_grug in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-03-2019, 07:41 PM
  2. [SOLVED] Offer Sales Codes marking
    By makinmomb in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 01-23-2016, 06:16 AM
  3. [SOLVED] Formular to seperate top 10 sales from a list
    By emymeeky in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-09-2014, 03:49 PM
  4. Pulling out certain Zip Codes in Sales Report
    By Jlynn in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 04-03-2008, 03:12 PM
  5. Is there a way to subtotal to seperate sheets in excel?
    By Eric Pulliam in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-09-2006, 12:55 PM
  6. [SOLVED] Best way to forecast individual sales territories?
    By Bill_S in forum Excel General
    Replies: 0
    Last Post: 02-03-2005, 11:06 AM
  7. Best way to forecast individual sales territories?
    By bill_s1416 in forum Excel General
    Replies: 0
    Last Post: 02-03-2005, 10:19 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1