+ Reply to Thread
Results 1 to 6 of 6

Query to subtotal by month

  1. #1
    Forum Contributor
    Join Date
    03-06-2013
    Location
    Salt Lake City, Utah
    MS-Off Ver
    2007, 2010
    Posts
    127

    Query to subtotal by month

    Hi,

    I have table of data that has a list of transactions by date. I'm trying to create a query that subtotals the transactions by year and month. Do any of you have a suggestion. Thanks.
    BrownBoy

    If happy, mark "SOVLED" & add to "REP"

  2. #2
    Forum Contributor
    Join Date
    03-06-2013
    Location
    Salt Lake City, Utah
    MS-Off Ver
    2007, 2010
    Posts
    127

    Re: Query to subtotal by month

    Paul,

    Thanks. I agree with you on that, however, I will be combining multiple queries into a master query that I will using in an Excel pivot table. The problem is some of tables already have transaction data by month while others do not. I want all the individual queries to be subtotaled beforehand for the sake of simplicity.

  3. #3
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Query to subtotal by month

    If you don't want to use an Access report....here's what I'd do:
    Create 3 queries
    1) Simply lists the details...with an added sort-reference column for YEARMTH with a zero appended.
    Example: 2014010

    2) Create a query that sums by month......with an added sort-reference column for YEARMTH with a 1 appended.
    Example: 2014011

    3) Create a query that sums by year......with an added sort-reference column for YEARMTH with a 999 appended to YEARMTH.
    Example: 2014999

    Last, create a union query that combines those 3 queries and sorts by YEARMTH.
    Continuing the example, those columns will sort this way
    2014010 <-Jan Detail
    2014010 <-Jan Detail
    2014010 <-Jan Detail
    2014010 <-Jan Detail
    2014011 <-Jan Month total
    2014020 <-Feb Detail
    2014020 <-Feb Detail
    2014020 <-Feb Detail
    2014021 <-Feb Month total
    2014999 <-Year total


    Is that something you can work with?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  4. #4
    Forum Contributor
    Join Date
    03-06-2013
    Location
    Salt Lake City, Utah
    MS-Off Ver
    2007, 2010
    Posts
    127

    Re: Query to subtotal by month

    I see where your going... let me put it together and then we will see. Thanks.

  5. #5
    Forum Contributor
    Join Date
    03-06-2013
    Location
    Salt Lake City, Utah
    MS-Off Ver
    2007, 2010
    Posts
    127

    Re: Query to subtotal by month

    Ron,

    Sorry it took so long to get back to you. I went with your Union query idea and got exactly what I needed. I'll export to Excel and group it there. Thanks.

  6. #6
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Query to subtotal by month

    Glad you got something you can use!

    If that resolves your issue, please take a moment to mark this thread as SOLVED (from the Thread Tools menu)

+ 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. Subtotal by month
    By sabbur in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-21-2014, 02:06 PM
  2. Subtotal in PivotTable on month
    By LouisH in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-03-2013, 06:22 AM
  3. grouping and subtotal by month
    By bix in forum Excel General
    Replies: 1
    Last Post: 07-11-2006, 07:33 AM
  4. [SOLVED] subtotal nesting errors new this month
    By Greenebush in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-17-2006, 06:40 PM
  5. How to subtotal on month?
    By supermario77 in forum Excel General
    Replies: 1
    Last Post: 04-27-2005, 01:04 PM

Tags for this Thread

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