• Subtotal Reporting (03)

    Author
    Topic
    #439356

    I have data that I would like to subtotal on each change in field (let’s call it FIELD1) and sum on total cost. As an example each row contains either a fruit or vegetable in that particular field with no specific sort order.

    I know that in order for the subtotal feature to properly work the data should be sorted first on FIELD1 and then apply the subtotal to the data. My challenge is to maintain the original order of entry prior to the sort after removing the subtotals. I understand that another sort would be in order but was wondering if there was another approach.

    Thanks,
    John

    Viewing 0 reply threads
    Author
    Replies
    • #1049739

      You can apply subtotals on unsorted data, but you’ll get a lot of subtotal lines:

      Product Amount
      Apples 5
      Apples Total 5
      Pears 3
      Pears Total 3
      Apples 4
      Apples 2
      Apples Total 6
      Pears 6
      Pears 4
      Pears Total 10
      Grand Total 24

      I probably don’t understand what exactly you want to accomplish.

      • #1049740

        Hans,

        The intent is maintain the grouping therefore one total for apples and etc. I guess I will have to incorporate two sorts. The first to sort by FIELD1 and then another sort on another field such as LINE_NO.

        I thought there may be another approach but it does not look that there is.

        Regards,
        John

        • #1049742

          I’m afraid you’re correct. Or provide the totals for apples, pears etc. elsewhere, for example in a pivot table. The source data for a pivot table don’t have to be sorted.

          • #1049755

            You could use a pivot table, as Hans suggests, or use an array formula or DSUM function to calculate the total for rows that meet a given criteria (ie, the ‘type’ column = “pears,” “apples,” “oranges,” etc). If you prefer to use subtotals on sorted data, you should insert a new column with values of 1,2,3,4, incrementing for each row. After sorting by “type” and applying subtotals you can remove the subtotals and re-sort in this key number sequence to restore the original order.

    Viewing 0 reply threads
    Reply To: Subtotal Reporting (03)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: