View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Ifatooki[_2_] Ifatooki[_2_] is offline
external usenet poster
 
Posts: 11
Default Row totals Calculations in Pivot Table

How can i create a Calculated Feild that will work? I am trying to get
the Average Len of Stay
total days / count of records
each time i get some off the wall number

PT.CalculatedFields.Add Name:="ALOS", Formula:="=days/MRN"
With PT.PivotFields("ALOS")
.Orientation = xlDataField
.Function = xlAverage
.Position = 4
.Name = "ALOS"
.Value = "AlOS"
.NumberFormat = "#,##0.0"
'End With
PT.NullString = "0

here is what the data looks like
Data
Date Unit PT Days CMRN
05/02/2007La 3c 58 12
La 5c 27 8
La 5w 111 22
La 6c1 403 23
La 6c2 53 12
La 6w 100 19
La 7c1 112 23
La 7c2 103 16
La 7w 107 24
La Csu 152 16
La L&d 6 5
La Ldr 4 3
La3or1 1 1
La3pac 31 5


and this is what i get


Data
Date Unit PT Days CMRN Sum of ALOS
05/02/2007La 3c 58 12 4.69313E-07
La 5c 27 8 4.01333E-07
La 5w 111 22 4.99803E-07
La 6c1 403 23 1.81104E-06
La 6c2 53 12 4.03597E-07
La 6w 100 19 5.86634E-07
La 7c1 112 23 4.65116E-07
La 7c2 103 16 6.26936E-07
La 7w 107 24 4.84436E-07
La Csu 152 16 1.01342E-06
La L&d 6 5 8.55786E-08
La Ldr 4 3 1.00836E-07
La3or1 1 1 1.15108E-07
La3pac 31 5 7.0482E-07
Lacbiu 7 5 1.85547E-07


Help Please