Column subtotals and totals (Xero) |
Top Previous Next |
This example demonstrates:
Column Subtotals with FullSpeed As this is written, Xero does not have the ability to provide subtotals on data entry forms (invoices, purchase orders, etc.). A FullSpeed macro can give you subtotals, and they work almost identically to totals, as described in the Column total (Xero) topic. This example shows how to subtotal the quantity column on a Xero form. Getting Ready Instead of using existing Inventory Items to trigger FullSpeed calculations, usually you will set up new items specifically for that purpose. This assures the item won't record income unless you want it to (if the Unit Price is set to 0) and it lets the item provide any descriptive information you may want. Here's an Inventory Item, SubtotQty, added for subtotaling the quantity column. Notes:
Use the item on a form Select the SubtotQty item on the line immediately below each group of lines you want to subtotal. Enter a formula for subtotaling the Qty column, and its trigger text
The Qty column is the third column on the form (see the screenshot above), so put the formula in at least the third column of the macro worksheet. You need to leave room for form's first column—the Item column—because it will need to contain the trigger text, SubtotQty. Notice that this formula actually sums the Sandbox rows of the Qty column. That is a shorthand way of telling FullSpeed to sum the entire Qty column when the macro runs.
That way, when FullSpeed encounters SubtotQty in Xero it will calculate the formula.
Choose macro options Choose appropriate options for running the macro:
Running the Macro
Why the first cell? Because FullSpeed macros process a form downward from where the macro is invoked (run). To total the entire Qty column we must begin at the top of the column. Why the Qty column? Because that's what we selected as the Begin field in the macro worksheet.
FullSpeed will traverse the form, gathering data. As it reaches each SubtotQty row it will write a subtotal in the Qty field. Can I have Subtotals and Totals? Yes! You can nest any number of subtotal and total levels on your forms. Just use a different trigger item for each level. Here's the same example as the above, but with a TotalQty item (from the Column totals (Xero) example) added to the form (note the green arrow): And here is the macro worksheet with the TotalQty item name and formula added on a separate text-triggered formula row: Notes:
Finally, here's the result of a macro run with both subtotals and a total: Can I Subtotal the Amount Column? Yes. The technique is a bit different and is discussed in the next topic, Subtotaling the Amount column (Xero). |