Home > database >  Calculate the average sales of every state using the Subtotal function on excel
Calculate the average sales of every state using the Subtotal function on excel

Time:11-11

I'm new to excel functions and I've been asked to calculate the average sales for every state using the "Subtotal" function.

The dataset is like this:

State Sales
California 22,5
Utah 75
Utah 122,4
California 99
Texas 101,3
Indiana 47
Texas 136

Can anyone help me?

CodePudding user response:

I'm not sure Subtotal is the best fit here. My first instinct would be to use a pivot table. You can also get the same answers with dynamic array formulas.

enter image description here

Formula in D3:

=SORT(UNIQUE(StatesTable[State]))

Formula in E3:

=SUMIFS(StatesTable[Sales],StatesTable[State],D3#)/COUNTIFS(StatesTable[State],D3#)
  • Related