ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to calculate total for a column with not all values filled (https://www.excelbanter.com/excel-programming/373005-how-calculate-total-column-not-all-values-filled.html)

[email protected]

How to calculate total for a column with not all values filled
 
Hi,

I am trying to get a OWC pivot table running through a Web page. I am
facing an issue while calculating total for one of the Fields. Not all
the cell for this field will have values. I am using the following code
to calculate the total and adding that field to the view.

[code]
Data as XML:
<z:row Classification='Country' CurrentLevel='331' TargetLevel='361'
Acct='9999AXH' Size='0.15' Return='0.26'/

' add data axis
oView.DataAxis.InsertFieldSet oView.FieldSets("Size")

'add total size column
Set totalSize = oView.AddTotal("Size
Total",oView.FieldSets("Size").Fields(0), c.plFunctionSum)
oView.DataAxis.InsertTotal totalAvgSize
[code]

I am getting an error - <b"Function cannot be applied to the given
field" </b. Appreciate your help in this.

Cheers


Pierre Archambault

How to calculate total for a column with not all values filled
 
Hi,

Try this formula:

=SUBTOTAL(9,A1:A100)

Replace "A1:A100" with your context.

Pierre

a écrit dans le message de news:
...
Hi,

I am trying to get a OWC pivot table running through a Web page. I am
facing an issue while calculating total for one of the Fields. Not all
the cell for this field will have values. I am using the following code
to calculate the total and adding that field to the view.

[code]
Data as XML:
<z:row Classification='Country' CurrentLevel='331' TargetLevel='361'
Acct='9999AXH' Size='0.15' Return='0.26'/

' add data axis
oView.DataAxis.InsertFieldSet oView.FieldSets("Size")

'add total size column
Set totalSize = oView.AddTotal("Size
Total",oView.FieldSets("Size").Fields(0), c.plFunctionSum)
oView.DataAxis.InsertTotal totalAvgSize
[code]

I am getting an error - <b"Function cannot be applied to the given
field" </b. Appreciate your help in this.

Cheers





All times are GMT +1. The time now is 10:30 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com