Hi! I need help calculating the summed values of a column. Also, the row values are subtracted from each other eg:
col1 col2 col3
row1 a b = a-b
row2 c d = c-d
row3 =a+c =b+d =a-b+(c-d)
however there can be N number of rows.
I have listed below and example I have done to calculate the subtracted values but I am having difficulty doing the summations.
<table width="362" border="1">
<tr>
<td width="91"> <input name='r1c1' onblur='function update_Total_r1c()' size='6' value=""> r1c1</td>
<td width="85"> <input name='r1c2' onblur='function update_Total_r1c()' size='6' value=""> r1c2</td>
<td width="164"> <input name='Total_r1c' onblur='function update_Total_r1c()' size='6' value=""> = r1c1 - r1c2</td>
</tr>
<tr>
<td>rNc1 <input name='rNc1' onblur='function update_Total_rNc()' size='6' value=""></td>
<td>rNc2 <input name='rNc2' onblur='function update_Total_rNc()' size='6' value=""> </td>
<td> <input name='Total_rNc' onblur='function update_Total_rNc()' size='6' value=""> = rNc1 - rNc2</td>
</tr>
<tr>
<td>sum( r1c1:rNc1)</td> [B]<- these are the values I am having trouble calculating[/B]
<td>sum( r1c2:rNc2)</td>[B]<- these are the values I am having trouble calculating[/B]
<td>sum(of above values)</td> [B]<- these are the values I am having trouble calculating[/B]
</tr>
</table>
</form>
<script type="text/javascript">
function update_Total_r1c() {
document.f1.Total_r1c1.value = (document.f1.r1c1.value -0) - (document.f1.r1c2.value -0);
}
function update_Total_rNc() {
document.f1.Total_rNc.value = (document.f1.rNc1.value -0) - (document.f1.rNc2.value -0);
}
</script>
Can anyone help?
Thanks