Average different cell ranges depending on the value of another cell

Nothnless

Board Regular
Joined
Apr 28, 2016
Messages
142
Hello, obviously this would be a simple average if formula but in this case I need to change the range to average based on the value of another cell. For example, if cell G9 = 2 then get the average of cells G13:G14 but if cell G9 = 3 then get the average of cells G13:G15. Can anyone help? Thanks!
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Welcome to the forum.

How about this?

Code:
=AVERAGE(INDIRECT("G13:G"&12+G9))
 
Upvote 0
Sweet, glad that it worked! The indirect function is a good one.
 
Upvote 0

Forum statistics

Threads
1,216,111
Messages
6,128,898
Members
449,477
Latest member
panjongshing

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