Subtotaling the Amount column (Xero) |
Top Previous Next |
This example demonstrates:
Prior topics showed how to subtotal a column of numbers—the Qty (quantity) column. This example deals specifically with getting subtotals in the Amount column. Unlike some programs, in Xero the Amount column is not accessible to FullSpeed. This may change in the future, but for now subtotaling financial amounts in Xero is not a straightforward task—it's simple to do, just not straightforward. Mainly, your macro must duplicate Xero's Amount column calculations. The only problem with this approach is that Xero and FullSpeed may not always round financial amounts the same way. Though rare, if this happens it could cause FullSpeed's subtotals and Xero's total for the form to differ by a cent or two.
The risk of a subtotal rounding error may or may not be acceptable to you. The benefits of having financial subtotals may outweigh the small risk of rounding errors in several situations:
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 a new Inventory Item, Subtotal, added for the purpose of triggering a subtotal calculation in a FullSpeed macro: Notes:
Use the item on a Xero form Select the Subtotal item on the line immediately below each group of lines you want to subtotal. Label columns in FullSpeed In FullSpeed, add column labels to the macro worksheet. This step is optional but will help you remember how the macro worksheet relates to the Xero form. Enter a formula to duplicate Xero's Amount column calculations Scroll to the right until you reach the first Scratchpad column, then enter a formula to multiply the Qty column by the Unit Price column, and round the result to 2 decimal places: =ROUND(E5*F5,2) Let's break down the formula to see how it works:
Here's the macro worksheet after entering the formula and adding some sample data, so we can see if the formula works: Notes:
Enter a subtotal formula, and its trigger text Enter the formula in the Description column of a text-triggered formula row. It should sum the range of Sandbox cells in the Scratchpad column. That tells FullSpeed to sum all of the Scratchpad rows accumulated so far, when the macro runs. Also, enter the trigger item's text in the Item column of that same row: Notes:
Format the subtotal formula cell as currency The amount (233.7) is correct but needs to be displayed as dollars and cents (currency). Right-click the cell and select Format cell from the menu. Then select a currency formatting option: After closing the formatting dialog, the cell should display the results as dollars and cents: 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 subtotal the entire Qty column the macro must begin at the top of the column.
FullSpeed will traverse the form, gathering data. As it reaches each Subtotal line it will put a subtotal in the Description field. Here's how it should look after the macro has run: |