Thread
:
How to display dash instead of #REF
View Single Post
#
10
Posted to microsoft.public.excel.worksheet.functions
[email protected]
external usenet poster
Posts: 25
How to display dash instead of #REF
Thanks for all the assistance on this issue everyone and sorry it took
me so long to get back to this topic. Harlan, the second formula that
you provided is what worked wonderfully for me.
Harlan Grove wrote:
wrote...
{=AVERAGE(N(OFFSET(A13,,
LARGE((G13:IV13<"")*(COLUMN(INDIRECT("G:IV"))),{ 1,2,3,4})-1,1,1)))}
...
First, it helps to understand what this formula is doing. It's
calculating the average of 4 different cells. Those cells are the 4
rightmost nonempty cells in G13:IV13. If there are fewer than 4
nonempty cells in that range, your formula returns #REF!. If you only
want the average when there are at least 4 nonblank cells, use the
array formula
=IF(COUNTA(G13:IV13)=4,AVERAGE(N(OFFSET(A13,,
LARGE((G13:IV13<"")*COLUMN(G13:IV13),{1,2,3,4})-1,1,1))),"-")
Note that this replaces INDIRECT("G:IV") with G13:IV13 in the COLUMN
call. This may not be strictly necessary, but it returns the same
array, and it'll automatically adjust the range reference if you insert
or delete columns between G and IV.
Note also that both formulas will treat any cells containing text as
numeric zeros, so the average of {1,2,3,"x"} will be the same as the
average of {1,2,3,0} rather than {1,2,3}. If you want the average only
of cells containing numbers, use the array formula
=IF(COUNT(G13:IV13)=4,AVERAGE(N(OFFSET(A13,,
LARGE(ISNUMBER(G13:IV13)*COLUMN(G13:IV13),{1,2,3,4 })-1,1,1))),"-")
Reply With Quote
[email protected]
View Public Profile
Find all posts by
[email protected]