index match average

petewann

New Member
Joined
Sep 3, 2019
Messages
5
Hi
I have a few criteria:
  • store
  • postcode
  • average
[TABLE="width: 500"]
<tbody>[TR]
[TD]Store[/TD]
[TD]Postcode[/TD]
[TD]Age[/TD]
[/TR]
[TR]
[TD]store1[/TD]
[TD]1234[/TD]
[TD]20[/TD]
[/TR]
[TR]
[TD]store1[/TD]
[TD]1234[/TD]
[TD]53[/TD]
[/TR]
[TR]
[TD]store1[/TD]
[TD]1236[/TD]
[TD]18[/TD]
[/TR]
[TR]
[TD]store2[/TD]
[TD]4556[/TD]
[TD]21[/TD]
[/TR]
[TR]
[TD]
store2
<strike></strike>
[/TD]
[TD]4557[/TD]
[TD]25[/TD]
[/TR]
[TR]
[TD]
store2
<strike></strike>
[/TD]
[TD]4558[/TD]
[TD]30[/TD]
[/TR]
[TR]
[TD]
store3
[/TD]
[TD]6771[/TD]
[TD]41[/TD]
[/TR]
[TR]
[TD]
store3
<strike></strike>
[/TD]
[TD]6772[/TD]
[TD]25[/TD]
[/TR]
[TR]
[TD]
store3
<strike></strike>
[/TD]
[TD]6772[/TD]
[TD]39[/TD]
[/TR]
</tbody>[/TABLE]

My question is: in this case what is the average age of store1 if the postcode is 1234
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Turning your data into a pivot table would be the way I would do it. Add store and postcode to the rows, and add age to values and change the field value settings to average. But this formula will do it too.

<style type="text/css">table.LEGO-table {font-size: 12px;border: 1px solid #CCC;font-family: Arial, Helvetica, sans-serif;border-collapse: collapse;}.LEGO-table td {padding: 4px;margin: 3px;border: 0.1px solid #000000;}.LEGO-table th {background: linear-gradient(0deg, rgba(9,121,22,1) 24%, rgba(51,51,51,1) 100%);color: #FFF;font-weight: bold;border-collapse: separate;border: 0.1px solid #000000;}td.blank {background-color: #ebebeb;text-align: center;}.LEGO-table tr:nth-child(even) {background-color: #d9d9d9;}</style><table class="LEGO-table"><caption>LROBBO HTML</caption><thead><tr class="LEGO-firstrow"><tr><td class="blank"></td><td class="blank">A</td><td class="blank">B</td><td class="blank">C</td><td class="blank">D</td><td class="blank">E</td></tr><tr><td class="blank">1</td><th>Store</th><th>Postcode</th><th>Age</th><th></th><th></th></thead><tbody><tr><td class="blank">2</td><td>store1</td><td>1234</td><td>20</td><td></td><td>36.5</td></tr><tr><td class="blank">3</td><td>store1</td><td>1234</td><td>53</td><td></td><td></td></tr><tr><td class="blank">4</td><td>store1</td><td>1236</td><td>18</td><td></td><td></td></tr><tr><td class="blank">5</td><td>store2</td><td>4556</td><td>21</td><td></td><td></td></tr><tr><td class="blank">6</td><td>store2</td><td>4557</td><td>25</td><td></td><td></td></tr><tr><td class="blank">7</td><td>store2</td><td>4558</td><td>30</td><td></td><td></td></tr><tr><td class="blank">8</td><td>store3</td><td>6771</td><td>41</td><td></td><td></td></tr><tr><td class="blank">9</td><td>store3</td><td>6772</td><td>25</td><td></td><td></td></tr><tr><td class="blank">10</td><td>store3</td><td>6772</td><td>39</td><td></td><td></td></tr></tbody></table></br></br><table style="font-family:Arial; font-size:10pt; border-style: groove ;border-color:#00ff00; color:#000000; "><tbody><tr><td><b>Formulas - Array formulas require Ctrl+Shift+Enter</b></td></tr><tr><td><table class="LEGO-table"><tr><td>E2</td><td>=AVERAGEIFS($C$2:$C$10,$A$2:$A$10,"store1",$B$2:$B$10,1234)</td></tr></table></tbody></table>
 
Upvote 0
So, you select your data. Then either go to the ribbon and select the 'Insert' tab and click 'Pivot Table', or use the keyboard shortcut Alt+N+V. That will insert a pivot table. Then just do like I said before. You will see your available fields, i.e. Store, Postcode, and Age. Drag Store and Postcode to the 'Rows' area. Drag 'Age' to the 'Values' area. Then click on 'Age', click 'Field Value Settings', and change the calculation from sum to average.
 
Upvote 0
───────────────────░█▓▓▓█░▇▆▅▄▃▂
──────────────────░█▓▓▓▓▓█░▇▆▅▄▃▂
─────────────────░█▓▓▓▓▓█░▇▆▅▄▃▂
──────────░░░───░█▓▓▓▓▓▓█░▇▆▅▄▃▂ ...
─────────░███░──░█▓▓▓▓▓█░▇▆▅▄▃▂
───────░██░░░██░█▓▓▓▓▓█░▇▆▅▄▃▂
──────░█░░█░░░░██▓▓▓▓▓█░▇▆▅▄▃▂
────░██░░█░░░░░░█▓▓▓▓█░▇▆▅▄▃▂
───░█░░░█░░░░░░░██▓▓▓█░▇▆▅▄▃▂
──░█░░░░█░░░░░░░░█▓▓▓█░▇▆▅▄▃▂
──░█░░░░░█░░░░░░░░█▓▓▓█░▇▆▅▄▃▂
──░█░░█░░░█░░░░░░░░█▓▓█░▇▆▅▄▃▂
─░█░░░█░░░░██░░░░░░█▓▓█░▇▆▅▄▃▂
─░█░░░░█░░░░░██░░░█▓▓▓█░▇▆▅▄▃▂
─░█░█░░░█░░░░░░███▓▓▓▓█░▇▆▅▄▃▂
░█░░░█░░░██░░░░░█▓▓▓▓▓█░▇▆▅▄▃▂
░█░░░░█░░░░█████▓▓▓▓▓█░▇▆▅▄▃▂
░█░░░░░█░░░░░░░█▓▓▓▓▓█░▇▆▅▄▃▂
░█░█░░░░██░░░░█▓▓▓▓▓█░▇▆▅▄▃▂
─░█░█░░░░░████▓▓▓▓██░▇▆▅▄▃▂
─░█░░█░░░░░░░█▓▓██▓█░▇▆▅▄▃▂
──░█░░██░░░██▓▓█▓▓▓█░▇▆▅▄▃▂
───░██░░███▓▓██▓█▓▓█░▇▆▅▄▃▂
────░██▓▓▓███▓▓▓█▓▓▓█░▇▆▅▄▃▂
──────░█▓▓▓▓▓▓▓▓█▓▓▓█░▇▆▅▄▃▂
──────░█▓▓▓▓▓▓▓▓▓▓▓▓▓█░▇▆▅▄▃▂
 
Upvote 0

Forum statistics

Threads
1,223,246
Messages
6,170,988
Members
452,373
Latest member
TimReeks

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top