Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Having trouble with Word 2003 table calculations

Status
Not open for further replies.

linusvp

IS-IT--Management
Apr 3, 2008
1
US
Hello,
I'm running MS Word 2003 and having some difficulty figuring out how to template out some automatic calculations within a table. I'm wondering if this is going to require a combination of formulas and macros (both of which I'm not too familiar with ).

Here's the details:

This is a template for an invoice. The invoice has a single table. The first row of the table has the column headings (which are set to repeat on each additional page).

The table has columns A through N. It's important to mention that the number of rows present varies depending on how many row entries are added for any given invoice.

The following calculations need to be automatically made as data is entered in each row. Again, the first row contains the column headings so all calculations would need to be made after row 1. And the calculations can't just be cell specific as the number of rows will vary. They'd need to be just column specific.

column E (# of days) * column F ($ rate A) = column G (subtotal 1)

column I (# of days) * column J ($ rate B) = column J (subtotal 2)

column G (subtotal 1) + column J (subtotal 2) = column N (total for that row)

These 3 calculations need to be made for each row that is added. And the values for # of days and rates may be different for every row that is added.

I can easily set up cell specific calculations, but can't figure this one out. Is this even possible with MS Word?

Thanks in advance for any insight on how to tackle this problem!
 
Not sure if its possible, but is there a reason you can't do this in Excel instead?

--Dan
Whenever you find yourself on the side of the majority, it is time to pause and reflect.
Mark Twain
 
Hi linusvp,
Is this even possible with MS Word?
Yes, but I'm not sure it's worth the effort, given Excel's greater flexibility. You could, for example, embed an Excel worksheet in your document and use that for the number crunching.

The biggest problem doing this in a Word table is that any formulae you use won't be added to any new rows that are inserted into the table. The other thing you'll need to deal with is the fact that, unlike Excel, cell references in Word are always absolute - copying a formula like =A1*B1 down from C1 to C2 doesn't update the row references to =A2*B2 - they remain =A1*B1!

There are ways around both issues using a document set up with formfields and protection for forms, plus there are ways of achieving relative referencing (in Excel, you could get around this via the use of named ranges and array formulae).

If you still want to give it a go with Word tables, check out my Word Field Maths 'tutorial', at:
http://www.wopr.com/cgi-bin/w3t/showthreaded.pl?Number=365442
or
http://www.gmayor.com/downloads.htm#Third_party

Cheers

[MS MVP - Word]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top