Question

WARNING - Using Excel 2011 for Macs, inexperienced user

Hi All,

I have a sheet in Excel with a bunch of categorical fields and some numerical ones as well. Let's say it looks like the following:

enter image description here

I would like to make a pivot table that will display the average click rate (avg_click_rate) of the unique combinations of [year, region], i.e. the combinations of fields in the pivottable's rows section.

For example, the avg_click_rate of [years=5] is:

(0.5*10)/(10 +5 ) + (0.6*5)/(10+5) = 0.53

while the avg_click_rate of [region=north] is:

(0.6*5)/(5+20) + (0.2*20)/(5+20) = 0.28

and the avg_click_rate of [years=5, region=south] is:

(0.5*10)/10 = 0.5

I know I have to make a custom Calculated Field to do this, but for the life of me I cannot figure out how to code the formula. Any help would be seriously, seriously appreciated.

To be clear, my formula would be:

SUM{ (click_rate * number_members) / SUM{number_members} }

where the numerator is a single value for each row included in the unique combination of [year, region], while the denominator is a constant - the total number_members for the unique combination of [year, region].

Was it helpful?

Solution

You should create a new column in your source table:

product = click_rate * number_members

And then create a Calculated Field in the pivot table:

CF = product / number_members

OTHER TIPS

Using AVERAGEIFS:

AVERAGEIFS($C$2:$C$9,$A$2:$A$9,A2,$B$2:$B$9,B2)

enter image description here

EDIT:

You can add up to 127 conditions, see: AVERAGEIFS function

Criteria_range1, criteria_range2, … are 1 to 127 ranges in which to evaluate the associated criteria.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top