ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   PivotTable: Averaging over 0 (Null) Fields (https://www.excelbanter.com/excel-programming/378722-pivottable-averaging-over-0-null-fields.html)

ion

PivotTable: Averaging over 0 (Null) Fields
 
Hi! I'm counting things in my database. So I get records like
fleem spork morgo darp
a 1 ˜º 2
b 1 ˜º 4
c 1 ˜º 9
a 2 ˜º 4
c 2 ˜º 2
a 1 ˜¼ 1
b 1 ˜¼ 5
c 1 ˜¼ 2
a 2 ˜¼ 3
b 2 ˜¼ 0
c 2 ˜¼ 4

in my query, where 'darp' is my aggregate. So, I load this into my
pivot table with a little VBA, and I include the line
' show zero for the null fields
pt.NullString = "0"
OK? I now have a pivottable that looks like
Sum of darp morgo
spork fleem ˜º ˜¼
1 a 2 1
b 4 5
c 9 2
1 Sum 15 8
1 Average 5 2.666666667
2 a 4 3
b 0 0
c 2 4
2 Sum 6 7
2 Average 3 2.333333333


Now, I want to get the average of darp over a fleem. But, since there
is no spork = 2 value defined for fleem=b and morgo=˜º, the average of
all darp over spork=2 is (4+2)/3 = 3, not (4+2+0)/3 = 2. For spork = 2,
fleem = b, morgo=˜¼, the 0 is defined and behaves correctly.

How can I get this query to treat that missing value as a zero value?
I'm trying calculated fields, but they seem not to have subtotals at
all.



All times are GMT +1. The time now is 11:01 PM.

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