Automatically add a row that sums the table

Automatically add a row that sums the table

aitorm
Advocate Advocate
569 Views
6 Replies
Message 1 of 7

Automatically add a row that sums the table

aitorm
Advocate
Advocate

Hi!

 

There is a process I repeat tons of times and would be amazing if you could help me automatize: I usually do dataextraction to create carpet area tables, but after it is created I need to add a total cell that sums all the value columns. This is how I do it (and would like it to be):

 

— Adds a new row at the bottom of the table and unlocks it

— Let you choose the column that I want to sum (normally B but it can be C or D)

— Create a sum formula that is =SUM(B3-BX), beeing X all the arrows of the table -1

[%<\AcObjProp Object(%<\_ObjId xxxxxxxxxxx>%).Rows>% - 1]

— Change its format to 2 decimals and m² as a sufix.

 

 

Could you help me create this?

 

Thank you so much,

0 Likes
Accepted solutions (2)
570 Views
6 Replies
Replies (6)
Message 2 of 7

cadffm
Consultant
Consultant
Accepted solution

Hi,

 

It's a question about how you created the table.

Is is a manually filed table, or automatically created by DataExtraction?

In Dataextraction, page 5 of 8, right click, ass sum row

Sebastian

0 Likes
Message 3 of 7

Brock_Olly
Collaborator
Collaborator
Accepted solution

I'd like to point out that you can also add a sum through the formula function. When you insert a row it automatically increases the range like you'd expect, except when you insert in the bottom row.

Message 4 of 7

Sea-Haven
Mentor
Mentor

Some hints re tables,

 

(setq rows  (vla-get-Rows objtable))

(vla-InsertRows Objtable  rows (vla-GetRowHeight Objtable (1- rows)) 1)

(vla-settext objtable rows 3 Str) ; str "=sum E1:E5"
; use this to convert column numbers to a alpha
; Number2Alpha - Converts Number into Alpha string
; Function By: Gilles Chanteau from Marseille, France
; Arguments: 1
;   Num# = Number to convert
; Syntax example: (Number2Alpha 731) = "ABC" 1="E"
;-------------------------------------------------------------------------------
(defun Number2Alpha (Num# / Val#)
  (if (< Num# 27)
    (chr (+ 64 Num#))
    (if (= 0 (setq Val# (rem Num# 26)))
      (strcat (Number2Alpha (1- (/ Num# 26))) "Z")
      (strcat (Number2Alpha (/ Num# 26)) (chr (+ 64 Val#)))
    )
  )
);defun Number2Alpha

 

0 Likes
Message 5 of 7

aitorm
Advocate
Advocate

True!! thanks a lot!!

 

I cannot add the totals footer to a column that is automatic, but I can add it to a formula column, which is good enough.

 

Screenshot 2025-02-05 090201.png

0 Likes
Message 6 of 7

aitorm
Advocate
Advocate

Thats a good point! thanks

0 Likes
Message 7 of 7

cadffm
Consultant
Consultant

Perhaps, you tried to sum characters, names like in column 1, instead of columns with numbers to sum.

Try right-clicking in a column that only contains numbers, like the second/AREA

 

cadffm_0-1738747213626.png

 

Sebastian

0 Likes