#value error in average formula with indirect function

tdg

New Member
Joined
Feb 23, 2011
Messages
16
Hi,

New to the forum. I'm trying to set up a formula that will average some numbers. The numbers I want it to average will be specified via the indirect function. The range of numbers to average may not be contiguous, so there may be numbers in a1:a5,a8:a10, for example. I want the formula to have the capability to average as many as 5 different subranges (where a subrange in the previous example is a1:a5). So I've set up this formula

=AVERAGE(INDIRECT(A342):INDIRECT(A343),IF(OR(A344="",A345=""),"",INDIRECT(A344):INDIRECT(A345)))

And this sort of works, but it only has 2 different subranges and it doesn't like it if a344 or a345 is blank. I know that the range to average will have at least two values - specified by INDIRECT(A342):INDIRECT(A343). I had hoped that I'd just be able to repeat the if statement 4 times to give the 5 subrange capability, but something isn't right.

I wondered if it needed a ctrl-shift-enter, but that didn't do it.

Thanks!
Tim
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
For your specific example try:

=IF(OR(A342="",A343=""),"",AVERAGE(INDIRECT("A342"):INDIRECT("A343")))
 
Upvote 0
Hi,

Perhaps, try this:

Code:
=SUM(INDIRECT(A342):INDIRECT(A343),IF(A344="",0,INDIRECT(A344)),IF(A345="",0,INDIRECT(A345)))/COUNTA($A$342:$A$345)
 
Upvote 0
Thanks for looking at my question!

But I really want the formula to look for multiple subranges, not just a342:a343. I want it to check and see if there are ranges specified in a343:344 and/or in a345:a346 and/or a347:a348, etc. If there are any cell references specified in those cells, I want the formula to look up the values in those references and include them in the average. If there aren't cell references in some/any of them, I want the average to ignore those.
 
Upvote 0
This almost works! The only problem is that this part of your eqn

IF(A344="",0,INDIRECT(A344)),IF(A345="",0,INDIRECT(A345))</pre>tells Excel to add individual numbers to the list of things to average. I want these two cells to give a range of cells. And you can't just swap the comma between the two IF statements with a colon.
 
Upvote 0
Welcome to the Board!

This should work, but requires you to have Excel 2007 or newer, it can be modified for older versions, but will be much longer, cause you will need to use if(iserror()) statements to check instead of just iferror:
Excel Workbook
ABC
164.222222
17c23
18c25
19c29
20c31
21c33
22c36
233
244
255
26
27
28
292
303
314
32
33
342
356
369
37
38
39
40
41
42
Sheet15
Cell Formulas
RangeFormula
A16=(IFERROR(SUM(INDIRECT(B17):INDIRECT(B18)),0)+IFERROR(SUM(INDIRECT(B19):INDIRECT(B20)),0)+IFERROR(SUM(INDIRECT(B21):INDIRECT(B22)),0)+IFERROR(SUM(INDIRECT(B23):INDIRECT(B24)),0))/COUNT(INDIRECT(B17):INDIRECT(B18),INDIRECT(B19):INDIRECT(B20),INDIRECT(B21):INDIRECT(B22),INDIRECT(B23):INDIRECT(B24))

Hope that helps.
 
Upvote 0
I'm not sure what can easily be done, as here is the equation for calculating the standard deviation in simplest form:

http://standard-deviation.appspot.com/

But the sticking point would be to take the mean away from each individual number. I will try to look into it tomorrow, but do not have the time today.
 
Upvote 0

Forum statistics

Threads
1,224,558
Messages
6,179,512
Members
452,920
Latest member
jaspers

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