A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » Tables
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Alternatives to Sum(Above)



 
 
Thread Tools Display Modes
  #1  
Old September 8th, 2004, 04:32 PM
solex
external usenet poster
 
Posts: n/a
Default Alternatives to Sum(Above)

The sum(above) function is flakey to say the least has anyone written a
replacment vba macro to perfor the same function?

Thanks,
Dan


  #2  
Old September 8th, 2004, 05:36 PM
Suzanne S. Barnhill
external usenet poster
 
Posts: n/a
Default

See http://word.mvps.org/FAQs/AppErrors/...eIncorrect.htm

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

"solex" wrote in message
...
The sum(above) function is flakey to say the least has anyone written a
replacment vba macro to perfor the same function?

Thanks,
Dan



  #3  
Old September 8th, 2004, 05:36 PM
Suzanne S. Barnhill
external usenet poster
 
Posts: n/a
Default

See http://word.mvps.org/FAQs/AppErrors/...eIncorrect.htm

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

"solex" wrote in message
...
The sum(above) function is flakey to say the least has anyone written a
replacment vba macro to perfor the same function?

Thanks,
Dan



  #4  
Old September 8th, 2004, 09:32 PM
solex
external usenet poster
 
Posts: n/a
Default

Alot of people point to that page but it would not solve my problem. I am
using word as a reporting template to output access data. The user does not
want to interact with word and any point except the initial design of the
document.

My solution was to create a new tag to represent the number of rows in the
sum formula and then subsitute that tag with number of rows after the data
has been inserted. Apparently the SUM(A1:A50) does not exhibit the same
problems as SUM(ABOVE).

Thanks,
Dan

Example of the field with the new tag:
{ = SUM(B3:BROWS /) \# "#,##0;(#,##0)" }


I then call this routine to update the formulas in the document.

Public Sub FieldTagSubsitution(ByRef doc As Word.Document, _
ByVal Tag As String, ByVal ReplaceWith As String)

' Looks through the fields for the specified tag and
' replaces the tag with the passed in value then updates the fields.

Dim fld As Word.Field
Dim code As String

For Each fld In doc.Fields
code = fld.code.Text
If InStr(code, Tag) 0 Then
fld.code.Text = Replace(code, Tag, ReplaceWith)
fld.Update
End If
Next

Set fld = Nothing
End Sub


"Suzanne S. Barnhill" wrote in message
...
See http://word.mvps.org/FAQs/AppErrors/...eIncorrect.htm

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup

so
all may benefit.

"solex" wrote in message
...
The sum(above) function is flakey to say the least has anyone written a
replacment vba macro to perfor the same function?

Thanks,
Dan





  #5  
Old September 10th, 2004, 11:46 PM
macropod
external usenet poster
 
Posts: n/a
Default

Hi Dan,

The two-table solution mentioned at:
http://word.mvps.org/FAQs/TblsFldsFms/TotalColumn.htm
(url all one line)
would seem ideally suited to your situation.

For more information on the limitations of SUM(ABOVE) etc, and solutions to
various field math problems, check out:
http://www.wopr.com/cgi-bin/w3t/show...&Number=365442
(url all one line)

Cheers


"solex" wrote in message
...
Alot of people point to that page but it would not solve my problem. I am
using word as a reporting template to output access data. The user does

not
want to interact with word and any point except the initial design of the
document.

My solution was to create a new tag to represent the number of rows in the
sum formula and then subsitute that tag with number of rows after the data
has been inserted. Apparently the SUM(A1:A50) does not exhibit the same
problems as SUM(ABOVE).

Thanks,
Dan

Example of the field with the new tag:
{ = SUM(B3:BROWS /) \# "#,##0;(#,##0)" }


I then call this routine to update the formulas in the document.

Public Sub FieldTagSubsitution(ByRef doc As Word.Document, _
ByVal Tag As String, ByVal ReplaceWith As String)

' Looks through the fields for the specified tag and
' replaces the tag with the passed in value then updates the fields.

Dim fld As Word.Field
Dim code As String

For Each fld In doc.Fields
code = fld.code.Text
If InStr(code, Tag) 0 Then
fld.code.Text = Replace(code, Tag, ReplaceWith)
fld.Update
End If
Next

Set fld = Nothing
End Sub


"Suzanne S. Barnhill" wrote in message
...
See http://word.mvps.org/FAQs/AppErrors/...eIncorrect.htm

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the

newsgroup
so
all may benefit.

"solex" wrote in message
...
The sum(above) function is flakey to say the least has anyone written

a
replacment vba macro to perfor the same function?

Thanks,
Dan







---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.736 / Virus Database: 490 - Release Date: 9/08/2004


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
More alternatives to text boxes. David Young Page Layout 2 April 26th, 2004 04:47 PM


All times are GMT +1. The time now is 03:00 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.