dbickin
Group: Members
Posts: 23
Joined: Mar. 2005 |
|
Posted: July 08 2005,18:01 |
|
I modified it to add the values in a second column passed as an argument
Code Sample | (define (ttt mytotalcolumn) (set! myrow R) ;; set our counter to the current row (while (not (null? (@ myrow C))) ;; check that the value exists (next-line) ;; move to the next line (if (not (= (@ myrow C) (@ (+ myrow 1) C)));; are the 2 cells = (prog1 (set! groupsum (sub-total mytotalcolumn)) (insert-line) ;; add extra counting and summing here (next-line) ;; go to the next line (set-data nil (number->string groupsum) 0 LABEL (make-position (+ R myrow) mytotalcolumn )) (set! myrow (+ myrow 1));; increase the row counter ) ) (set! myrow (+ myrow 1)) ;; increase the row counter ) )
(define (sub-total mytotalcolumn) (set! mytotal 0) (set! mycount 0) (set! mytarget (@ myrow C)) (while (and (> (- myrow mycount) 0) (= mytarget (@ (- myrow mycount) C))) (set! mytotal (+ mytotal ( @ (- myrow mycount) mytotalcolumn) ) ) (set! mycount (+ mycount 1)) ) mytotal )
|
(Hopefully I transcribed the changes correctly. my DSL laptop is not networked!)
I'm going to have to see if I can figure out how to get it to work when the key column has text instead of numbers in it. And see if I can figure out how to make the totals show in bold. (I hate that Excel doesn't do that! OpenOffice got it right.)
Clacker, in your searches through the files, have to run into anything like an Outline in OpenOffice Calc. That is... [+] or [-] button to the left of the spreadsheet tht either shows or hides the detail of each subtotal function?
H'm, I suppose I should look to see if siag CAN hide or show rows before I ask a question like that..... Oh well. Much to learn.
Thanks for all your help.
David
|