FuturePayments Now Banner
Row or column sums of an HTML table
Work - Administration
Tuesday, 11 March 2008 19:27

Sometimes I make notes in HTML format. Often this involves putting numbers in tabels and computing the sum of the rows and/or columns. It is possible to do this with a spreadsheet program but you might as well use the calculator below.

The calculator is implemented in javascript. So no data is sent to the server.

Instructions:

  • Copy the HTML source to the input field. Overwrite the example input. The HTML source should be an HTML table, including the table-tags (<table ...> and </table>).
  • Choose whether you want to compute row sums or column sums.
  • Field Formula. It is possible to enter a formula in the variable x and compute the value of the formula on each element and sum these values for each row or column. The formula should be a javascript expression including the functions of the Math object. An example of a valid formula is sin(x) +1. If this field is empty then the calculator computes ordinary row or column sums.
  • Results can be rounded using the function rvb_round in the formula, for example rvb_round(cos(x)+1,2).
  • Field Rows or columns to be summed: choose the column numbers or row numbers that need to be summed. When columns are summed then enter row numbers here, otherwise enter column numbers. Leave this field empty if all rows or columns need to be summed. Example: 1,last,3
  • Likewise enter rows and columns that need to be excluded from the summation in field Exclude rows or columns.
  • Click finally on Compute. The result will appear in red.
  • With the button View HTML result you can view the HTML source of the result and copy and past it elsewhere.

With the button View input you can view the input HTML source as webpage. A new window pops up after pressing this button.