Hello everyone,
Sorry for the cryptic subject, but I couldn't come up with something more descriptive.
I have a macro called 'addTotals' (cf attachment).
The input is a dataset (variable number of fields), the fields in that dataset for which we want totals (variable number of records) and the name that the total should have.
What it does is, for a number of specified columns, append the dataset again but with value 'total'.
Let's say my data is the following:
| fieldA | fieldB | fieldC | value |
| A | C | E | 0,15 |
| B | D | F | 0,25 |
and let's say I need totals for 'fieldA' and 'fieldB', then the macro will create the following:
| fieldA | fieldB | fieldC | value |
| Total | C | E | 0,15 |
| Total | D | F | 0,25 |
| A | Total | E | 0,15 |
| B | Total | F | 0,25 |
This works fine, but I also need the combined 'Totals'.
So the part that I'm missing is
| fieldA | fieldB | fieldC | value |
| Total | C | E | 0,15 |
| Total | D | F | 0,25 |
| A | Total | E | 0,15 |
| B | Total | F | 0,25 |
| Total | Total | E | 0,15 |
| Total | Total | F | 0,25 |
Does anyone know how to add this in a flexible way?
I know that the field will have a certain name (in this case 'Total') because it's one of the 3 macro inputs.
The number of fields for which I want totals is not fixed, nor is the total number of input fields.
Thanks a bunch,
Mikis