Hi,
thanks for your post, and sorry for the trouble.
For this, just wrap your SUM equation in a NUMBER_FORMAT call:
=NUMBER_FORMAT( SUM( G2:G4 ), 2 )
Regards,
Tobias
Perfect!
Just one more thing is there any way to autosum say column G automatically when a new row is added from G2 onwards instead of editing the “=NUMBER_FORMAT( SUM( G2:G4 ), 2 )” each time?
Thanks 🙂
Hi,
if you use the “Insert row” button (when a row in the range of G2 to G4 is checked, by marking its checkbox on the left), the range should automatically expand.
Regards,
Tobias
Hi,
no problem, you are very welcome! 🙂 Good to hear that this helped!
Best wishes,
Tobias
P.S.: In case you haven’t, please rate TablePress here in the plugin directory. Thanks!
Hi Tobias,
I am just wondering is it possible to SUM just the visible rows which have been filtered.
I get this error:
!ERROR! CIRCLE REFERENCE
Thanks
Hi,
not really, I’m afraid. As you can see, you get a circle reference, which means that the cell with the formula is part of the cells that are to be summed up.
Regards,
Tobias
Hi,
if you want to use SUM just the visible rows which have been filtered, it necessary to add a Table Footer
You should add a new row to the end of the table and click the “Table Footer” row as well.
and you can see
Sum of column
Best regards
Eric
Hi Eric,
yes, that would also be a nice solution.
Regards,
Tobias
Thanks for the reply guys.
Hi ericc44, I have added the footer and added this code but still see the !ERROR! Circle Reference, is this correct or did i miss something?
“footerCallback”: function( row, data, start, end, display ) { var api = this.api(), data; var intVal = function ( i ) { return typeof i === ‘string’ ? i.replace(/[\$,]/g, ”)*1 : typeof i === ‘number’ ? i : 0; }; total = api .column( 1, { page: ‘current’} ) .data() .reduce( function (a, b) { return intVal(a) + intVal(b); }, 0 ); $( api.column(1 ).footer() ).html( total ); $( api.column( 2 ).footer() ).html(‘Totals :’); }
Thanks
Hi,
as this JavaScript “Custom Command” is a replacement for the formulas on the “Edit” screen, you must also remove those. This basically shifts the calculation from the server side to the browser.
Regards,
Tobias
Hi,
Thanks Tobias it is true.
Note : first column number is 0
This code is correct and should sum all column 1 (column number 2 of your table) and add text ‘Totals :’ in your column 2 (column number 3 of your table).
Can you check you have only number in column 1 ?
Can you put a table link to check, please.
Best regards
Eric
Hi,
yes, a link to check would be great, if you can’t solve this.
Regards,
Tobias